You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Chan, Jim" <jc...@incognito.com> on 2004/03/19 18:42:17 UTC

Can coarse grained ActionForms validate?


Hi, I am using coarse grained action forms that are re-used by various
action classes.  Each of these action classes serve a different page and
retrieves information from the backend so that the jsp page can show it.
Now because I am using coarse grained forms, I have now way of knowing which
fields to validate because the same form serve multiple actions.  Also, if I
use the ActionForm class to validate the client data, the ActionForm has to
be responsible for re-initializing that page with backend information if
validation fails.  Therefore, even if I change to very fine-grained
DynaForms and use the validation framework so that each action maps to one
form, I will probably have to figure some way of fetching backend
information if validation fails.

Currently, I am doing all the client input validation in the action classes
because it seems to be the most simple solution; however, it has the caveat
that the action class is now responsible for both validation and backend
service delegation.  I am just wondering if there is a more elegant solution
using the action forms as the validator.

Any help is greatly appreciated.

Re: Can coarse grained ActionForms validate?

Posted by Blake Whitmore <bl...@yahoo.com>.
Hi Jim,

You can specify multiple form bean mappings per action
form.  For insance:

<form-bean name="registrationForm"
           type="com.pkg.MyFormBean"/>

<form-bean name="otherForm"
           type="com.pkg.MyFormBean"/>

Then, in your validation.xml, you can have different
rules for both of those forms. 

HTH,
Blake







--- "Chan, Jim" <jc...@incognito.com> wrote:
> 
> 
> Hi, I am using coarse grained action forms that are
> re-used by various
> action classes.  Each of these action classes serve
> a different page and
> retrieves information from the backend so that the
> jsp page can show it.
> Now because I am using coarse grained forms, I have
> now way of knowing which
> fields to validate because the same form serve
> multiple actions.  Also, if I
> use the ActionForm class to validate the client
> data, the ActionForm has to
> be responsible for re-initializing that page with
> backend information if
> validation fails.  Therefore, even if I change to
> very fine-grained
> DynaForms and use the validation framework so that
> each action maps to one
> form, I will probably have to figure some way of
> fetching backend
> information if validation fails.
> 
> Currently, I am doing all the client input
> validation in the action classes
> because it seems to be the most simple solution;
> however, it has the caveat
> that the action class is now responsible for both
> validation and backend
> service delegation.  I am just wondering if there is
> a more elegant solution
> using the action forms as the validator.
> 
> Any help is greatly appreciated.
> 


__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org