I know the Commons Validator framework is the de facto standard for Struts projects to validate input values both on the server side and the client side.
Is the same true for Spring MVC projects?
The reason开发者_运维技巧 I get the impression that it may not is that most Struts books and forums talk a lot about the Commons Validator framework, but only a few Spring books and forums do.
What's the best practice for validating input in Spring MVC projects?
Cheers!
Commons Validator is more or less obsolete now, following the introduction of the JSR-303 Validation API, which Spring 3 fully supports. It's an annotation-driven declarative framework.
See the relevant parts (here and here) of the Spring docs to see how Spring uses it.
These examples of server-side validation using JSR-330 rich client-side validation with Spring MVC should give you some easy-to-follow examples to get you started.
精彩评论