- JSR 380 is the Java API specification for Bean Validation
- It is used to validate model properties using annotations
- Standard JSR Annotations
– @NotNull: It will validate value is not null
– @AssertTrue: It will validate Boolean value
– @Size: This validates the size of the attribute like for string size min or max
– @Min: It validates minimum size value of the attribute
– @Max: It validates maximum size value attribute
– @Email: validates the Email address
– @NotEmpty: It validates Not null property
– @NotBlank - Defining Error message globally
javax.validation.constraints.Min.message=Value must be at least {value} - Defining Error message as property
@max (value=120, message="{age.too.old}")
//Annotation
age.too.old=Age must be under 120.// Message bundle property
Manually Passing Error Message

Configuring JSR 380
Configure validator in the applicationContext

*-servlet.xml

SpringMVC will automatically validates inputs from the controller
