CHAPTER 5: Building Java Web Applications with Spring Web MVC 257
Annotations-Based Validation
The following section demonstrates how you can validate the user-entered data using annotations.
Figure 5-22 illustrates the modified files and newly added files in the application.
Listing 5-50 illustrates the BookValidator.
Listing 5-50. Validations in the BookValidator
- package com.apress.bookstore.validator;
- import org.springframework.validation.Errors;
- import org.springframework.validation.ValidationUtils;
- import org.springframework.validation.Validator;
Figure 5-22. Modified files and new files in the directory structure for annotations-based validation