Preparing Multiple DynaValidatorForms 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Preparing Multiple DynaValidatorForm?s with one action
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Preparing Multiple DynaValidatorForm?s with one action
Cheers guys I kinda knew this was the response Id get separate actions it is then From: Adam Hardy <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: Struts Users Mailing List <[EMAIL PROTECTED]> Subject: Re: Preparing Multiple DynaValidatorForm?s with one action Date: Mon, 06 Oct 2003 23:16:21 +0200 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]