To apply form validation and input type conversion, do the following procedures:
- The validation process will progress after modifying the EmployeeForm form model of the previous recipe to contain three more request data, namely the email, age, and birthday of the employee:
public class EmployeeForm { private String firstName; private String lastName; private String position; // additional information private Integer age; private Date birthday; private String email; // getters and setters }
Primitive types are not recommended in declaring form model properties because form validation and type conversion works easily with object types. Thus, wrapper classes must be used instead of their primitive counterparts.
- The most straightforward ...