Jim, Me too.
Thank you, Frederic -----Original Message----- From: Renato Aganippe [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 8:52 AM To: Struts Users Mailing List Subject: Re: Struts and Many Buttons on Single page Jim, I'll be interested in your action code. Thank you, Renato ----- Original Message ----- From: <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, August 29, 2002 7:08 PM Subject: Re: Struts and Many Buttons on Single page > > Have been through this one; originally used option 2 (javascript to on > button click to change action), but as we use httpunit to acceptance test, > which does not support javascript, we migrated to a third option: > > Have a generic action to route based on button pressed. > > In the html: > <html:form action="/routeThisForm"> > <html:submit property="SubmitButton_A"/> > <html:submit property="SubmitButton_B"/> > ... > > In struts config.xml: > <action path="/routeThisForm" > type = "com.whatever.GenericSubmitRouteAction" > ... > <forward name="A" path="/A_Action.do"/> > <forward name="B" path="/B_Action.do"/> > </action> > > The code for the generic submit route action looks for which button was > pressed, and maps to the appropriately named forwarding. If anyone is > interested in this approach I'll post the code for the routing action. > > It would be nice if Struts somehow supported this sort of thing (forms with > multiple actions based on submit button pressed) inherently. > > > Jim Weaver > Software Developer - ThoughtWorks > [EMAIL PROTECTED] > > > > > "Renato Aganippe" > <raganippe@cardiw To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > eb.com> cc: > Subject: Re: Struts and Many Buttons on Single page > 08/29/2002 11:22 > AM > Please respond to > "Struts Users > Mailing List" > > > > > > > Hi, > > I see two solution for this. > > 1) For each button, you can define a different form with a different action > attribute > > > 2) You can use a javascript function to change the action attribute > > Ex: > <script language=JavaScript> > function doSubmit(val) { > if (val==1) { > document.forms.consult.action='/save.do'; > } > else if (val==2) { > document.forms.consult.action='/remove.do'; > } > document.forms.consult.submit(); > } > </script> > > <html:form name="consult" type="ActionForm" action="/save.do"> > > <input type=button class=simpletext value=Valider > onClick="doSubmit(1);return false;"> > <input type=button value="Delete" class="simpletext" onClick="if > (confirm('Etes vous certain de vouloir supprimer cet enregistrement ?')) > doSubmit(2); return false;"> > > </html:form> > > Hope it will help, > > Renato > > ----- Original Message ----- > From: "Ashish Kulkarni" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > Sent: Thursday, August 29, 2002 4:31 PM > Subject: Struts and Many Buttons on Single page > > > > > > Hi, > > > > I am developing a struts applicatian, I have a jsp page where i have 5 > buttons, say Add, Change,Delete, Display. > > > > When i click these buttons they must call different jsp with different > parameters, how can i do it??? > > > > Ashish > > > > > > A$HI$H > > > > > > --------------------------------- > > Do You Yahoo!? > > Yahoo! Finance - Get real-time stock quotes > > > > -- > To unsubscribe, e-mail: < > mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: < > mailto:[EMAIL PROTECTED]> > > > > > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>