You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pat Quinn <pa...@hotmail.com> on 2003/10/06 18:09:06 UTC
Preparing Multiple DynaValidatorForm�s with one action
I currently have an action (Action A) which is associated with Action_Form_A
( i.e. org.apache.struts.validator.DynaValidatorForm) i want to forward to
another tile definition which requires Action_Form_B. I want to initialise a
List in Action_Form_B how can i do this as the action i'm currently in only
knows about ACTION_FORM_A. I only want to intialise actionforms within a
common action i'll have seperate action to deal with submits.
I've tried casting the inbound Action Form to type DynaValidator and calling
the relevant set methods but this fails as you'd expect as its referencing
ACTION_FORM_A only.
Next i tried to create a new instance of DynaValidator & called initialise:
DynaValidatorForm dynaForm2 = new DynaValidatorForm();
dynaForm2.initialize(pMapping);
dynaForm2.set("name", "Joe Bloggs";
This too fails with a nullpointer... i could forward to another action which
prepares the actionform for the next view... is there another way i could do
this?
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Preparing Multiple DynaValidatorForm?s with one action
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Hi Pat,
are you sure you've got the best approach? Trying to shoe-horn two forms
into one request tells me generally (when it happens to me) that I
should refactor the design of whatever use-case I'm working on.
If I have a submit to one action mapping that on success must forward to
another action mapping with a completely different form, I use a
re-direct. Of course it drops all the data in-between but you're better
off in the long run.
Adam
On 10/06/2003 06:09 PM Pat Quinn wrote:
> I currently have an action (Action A) which is associated with
> Action_Form_A ( i.e. org.apache.struts.validator.DynaValidatorForm) i
> want to forward to another tile definition which requires Action_Form_B.
> I want to initialise a List in Action_Form_B how can i do this as the
> action i'm currently in only knows about ACTION_FORM_A. I only want to
> intialise actionforms within a common action i'll have seperate action
> to deal with submits.
>
> I've tried casting the inbound Action Form to type DynaValidator and
> calling the relevant set methods but this fails as you'd expect as its
> referencing ACTION_FORM_A only.
>
> Next i tried to create a new instance of DynaValidator & called initialise:
>
> DynaValidatorForm dynaForm2 = new DynaValidatorForm();
> dynaForm2.initialize(pMapping);
> dynaForm2.set("name", "Joe Bloggs";
>
> This too fails with a nullpointer... i could forward to another action
> which prepares the actionform for the next view... is there another way
> i could do this?
>
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
--
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org