Conclusions


Using DynaBean s and the Validator framework, you can reduce or even eliminate the need to write an ActionForm . DynaForm s enable you to define the properties of a form in the struts-config.xml file, rather than in the form bean itself. You then use generic get and set operations on the form, rather than explicitly defined accessors.

The Validator framework integrates Struts with the Commons Validator project. The validator enables you to define validation rules in XML files, and automatically run them against the form during submission. This eliminates the need for the validate method on the Form , and in combination with a DynaForm , it eliminates the need for a distinct class.

Because the framework doesn't handle all types of validations, it might be necessary to handle some of them in the Action , although this can confuse the user by presenting errors in two stages.

The Framework can also be extended by writing new validation rules, which are defined in one of the XML configuration files and implemented in a new class and method.



Struts Kick Start
Struts Kick Start
ISBN: 0672324725
EAN: 2147483647
Year: 2002
Pages: 177

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