Validating form hierarchy


There are still two more validation related Form classes ‚ ValidatorActionForm and DynaValidatorActionForm . A class diagram will resolve some of the confusion arising out of plethora of Form classes. Figure 5.1 shows the relationship between these classes. ActionForm and DynaActionForm reside at the top of the figure as the root class for two branches. ValidatorForm and DynaValidatorForm are their immediate siblings. Each of them has a subclass ‚ ValidatorActionForm and DynaValidatorActionForm . The last two classes deserve some explanation. Suppose that you have a Form and want to reuse it in various scenarios. Each scenario has its own validation. However with the XML based validation, a set of rules are associated with the form name , not where it is invoked from. Both the ValidatorActionForm and DynaValidatorActionForm match the action mapping instead of the form name. The name attribute is used to match the action mapping and thus multiple rules can be defined for the same form based on the action mapping.


Figure 5.1: Relationship hierarchy among Validating Forms.



Struts Survival Guide. Basics to Best Practices
Struts Survival Guide: Basics to Best Practices (J2ee Survival Series)
ISBN: 0974848808
EAN: 2147483647
Year: 2004
Pages: 96

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