Form validation and parameter type conversion
The advantage of using form backing objects in implementing request parameter handling is attributed to the ease of applying form input rules and validation to the incoming request data. Moreover, type conversion of some request parameters that are non-string can be done using property editors included in the framework.
Getting started
Open again the Eclipse STS ch03
project and perform the following steps for implementing the validator and input type conversion mechanism on simple form controllers without using any client-side scripts and services.
How to do it...
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 theemail
,age
, andbirthday
of the employee:
public class EmployeeForm { private String firstName; private String lastName; private String position;...