Posts

Showing posts with the label  tags:validations

Form validations in spring mvc.

Form Validations in Spring MVC:   org.springframework.validation.Errors; org.springframework.validation.ValidationUtils;   ValidationUtils provide us the validate(Object target, Errors errors) which needs to be overridden. target is the modal that needs to be validated and the  errors has the validation errors.   Simple validation class:   @Component public class sampleValidator {        public boolean supports(Class<?> clazz) {               return Job.class.isAssignableFrom(clazz);        }          public void validate(Object target, Errors errors) {                             User user = (User)target;        ...