THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Add the following validate method to Register.java (the Action class).
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
public void validate(){ if ( personBean.getFirstName().length() == 0 ){ addFieldError( "personBean.firstName", "First name is required." ); } if ( personBean.getEmail().length() == 0 ){ addFieldError( "personBean.email", "Email is required." ); } if ( personBean.getAge() < 18 ){ addFieldError( "personBean.age", "Age is required and must be 18 or older" ); } } |
...