I have an application which has around 30 forms.We are using dyna action forms. I have one action which has to be called from all these 30 forms. So do I need to have to need 30 mappings in the config file for each form? How will I handle that.. Thanks for the help, Manoj.

Ted Husted

It mainly depends on the validation needs. In practice, you do need an action-mapping each distinct validation that Struts must handle itself. Each of these action-mappings then need either a ActionForm or a Validator form to provide the validation behavior.

If you are using DynaActionForms, then you probably want to use the Struts Validator. You can create a Validator form for each validation instance. Then set the attribute property of the ActionMapping to match the Validator form name. The action-mapping can then all share the same form-bean (but validate a different set of properties). The DyanActionForm may define properties that some of the forms don't use, but that does no harm. (See also "Coarse-grained ActionForms").

If you were using conventional ActinForms, then you could create a base ActionForm with all the properties that your forms needed, and then a subclass for each validation. Then, instead of creating Validator forms you could create a form-bean for each validation instance.

HTH, Ted

--
Ted Husted,
Struts in Action

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact