Working with E-Mail and Credit Cards

 < Day Day Up > 



Working with e-mail and credit cards is quite easy because neither rule takes arguments. Both routines are converted from working routines that were used by JavaScript and Perl developers, respectively. Ted Husted translated these routines to Java and added them to the Validator Framework. Here's how you use them in the field declaration in validation.xml:

             <field property="email"                           depends="required,email">                    <arg0 key="inputForm.email" />             </field>             <field property="creditCard"                           depends="creditCard">                    <arg0 key="inputForm.creditCard" />             </field> 

This code maps the email rule to the email property and the creditCard rule to the creditCard field in our ActionForm. We added the creditCard and email properties in the Action and the corresponding labels in the resource bundle.

start sidebar

You can find the implementation for all the rules that ship with the Validator Framework in org.apache.struts.validator.FieldChecks and org.apache.commons.validator.GenericValidator.

end sidebar



 < 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