| < Day Day Up > |
|
Working with DynaActionForms is quite easy. When you set up the dynamic form in the Struts configuration file, use the DynaValidatorForm class instead of the DynaActionForm class as follows:
<form-bean name="inputForm" type="org.apache.struts.validator.DynaValidatorForm"> <form-property name="userName" type="java.lang.String" initial=""/>
The validate method of the DynaValidatorForm provides the necessary hooks into the Validator Framework to tie the validation rules you define in validation.xml to the fields you define in your DynaForm. The Validator Framework and the DynaForms have a special relationship. DynaForms typically rely on the Validator Framework to perform validation. All of the rules we configured and wrote would work the same with the DynaValidatorForm—we simply have to configure the form-property for each field.
| < Day Day Up > |
|