November 2016
Intermediate to advanced
944 pages
21h 1m
English
Spring MVC makes form validation a lot easier using Spring's Validator framework. You might have noticed the @Valid annotation and the usage of the BindingResult.hasErrors() method call inside handler methods listed in the previous section. They are part of the validation framework.
Let's create a validator for a Task object by following these steps:
javax.validation (build file: pom.xml).MessageSourceBean for the validation-errors properties file in your bean definition:<beans:bean id="messageSource" class="org.springframework.context. support.ReloadableResourceBundleMessageSource"> <beans:property name="defaultEncoding" value="UTF-8" /> <beans:property name="basenames" ...
Read now
Unlock full access