Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring MVC validation with Annotations

Tags:

People also ask

Does Spring MVC provide validation support?

EmployeeFormValidator is the validator implementation that is specific to Spring Framework. supports() method implementation by Spring Framework to know objects on which this validation can be used. We implement validate() method and add errors if any field validation fails. Spring provides org.

What is the use of @valid annotation in Spring?

The @Valid annotation will tell spring to go and validate the data passed into the controller by checking to see that the integer numberBetweenOneAndTen is between 1 and 10 inclusive because of those min and max annotations.


I'm having quite some trouble since I migrated my controllers from classical inheritance to use the annotations like @Controller and @RequestMapping. The problem is that I don't know how to plug in validation like in the old case. Are there any good tutorials about this?