简体   繁体   中英

Struts2 Validation or HTML5 validation?

Which have a better validation, HTML5 or Struts2? I was developing a project using the Struts2 structure but I am always confused and getting difficulties with it, and I found out that there is a validation at HTML5. So I was wondering if it is more reliable if I use HTML5 rather than the Struts2 validation.

Validation in HTML5 would be at the client end. Also if you have a browser that doesn't support complete HTML5 based validation, then they would not work.
Struts2 is a server side validation, which means if a client manages to send incorrect data it would be rejected at your server side.
In my opinion it is a MUST to have a Server Side validation (struts2 in your case) if your application is external facing (ie exposed to external users). Client side validations (HTML5) can support you to make the experience faster. For more details refer here

Struts2 validation is not the purely server side validation and not a client side validation too. Its taken as front-end validation of web application. By the way you can use this as your preference. All the clients are not well support for html5. So its better to choose struts2 validation. You would be able to do it on separate validation xml file. But its not must.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM