Struts web application: multiple client-side and server-side validation

Our Struts application duplicates many validation checks for forms: (1) Client side in jQuery / JS and (2) separately, server side in Java.

I asked why, and he said: "You never trust the client side." But, on the other hand, as a convenience, he also wants to provide JS / jQuery validation in the browser.

There is a lot of redundant code. What is the right strategy to re-check on both sides? Are people currently manually duplicating client / server side validation?

+1
source share
1 answer
  • : -, , FireBug DevTools. , , ( javascript, ), ad-hoc, .

, : . .

  • : , - , , ( , ).

, . , , . , , ... , .

, , Struts2 validate() validateXXX() XML Validation ( Struts2 Annotations jsr303-validator-plugin by @UmeshAwasthi per-entity).

, Struts2-jQuery-plugin, .

, HTML5 ( ) jQuery .

, , , .

+3

Source: https://habr.com/ru/post/1599068/


All Articles