Working with DynaActionForms

 < 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 > 



Professional Jakarta Struts
Professional Jakarta Struts (Programmer to Programmer)
ISBN: 0764544373
EAN: 2147483647
Year: 2003
Pages: 183

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net