Posts

Showing posts with the label Validation explained

Validation explained

Stuts2 uses XWork's validation framework internally.  It allows you to validate Models and Actions using a set of specialised (field)validators, grouped together in an xml file named YourModel-validation.xml or ActionName-validation (and, in the case of the alias, ActionName-alias-validation.xml). Since we only want to validate the crud action, we create a file EmployeeAction-crud-validation.xml and place it in our classpath (mostly next to our compiled Action class). < validators >    < field name = "employee.firstName" >       < field-validator type = "requiredstring" >          < message key = "errors.required.firstname" />        </ field-validator >    </ field >    < field name = "employee.lastName" >       < field-validator type = "required...