You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by imran ali <al...@rediffmail.com> on 2003/06/22 13:46:32 UTC
buttons in struts.
Hello
I am having two buttons in my jsp. On clicking one i shud submit form and on clicking another i should go to another jsp and get data there and upon hitting submit in that jsp I should come to my first jsp.
how can i achive it. Presently i have make both the buttons as submit type. but i don't know how i can pass the information which will help me in doing two different tasks using these two different buttons.
thanks.
Imran
RE: buttons in struts.
Posted by Brandon Goodin <ma...@phase.ws>.
You can use the LookupDispatchAction to accomplish what you want.
Basically, your form will submit to the same ActionForm and will go to the
same Action. But, depending on which button you click you can set the
LookupDispatchAction to call different methods in your LookupDispatchAction.
It is good practice to pass ALL requests through an Action when going from
page to page, even if it is a simple page to page navigation with no biz
layer interaction.
In your case you could set one button to call a method in you
LookupDispatchAction that simply calls mapping.findForward("gohere"). The
other method could contain the code you need the process your form and
forward to it's next view.
Here is a link to more info:
http://jakarta.apache.org/struts/api/org/apache/struts/actions/LookupDispatc
hAction.html
Brandon Goodin
-----Original Message-----
From: imran ali [mailto:aliimran@rediffmail.com]
Sent: Sunday, June 22, 2003 5:47 AM
To: struts-user@jakarta.apache.org
Subject: buttons in struts.
Hello
I am having two buttons in my jsp. On clicking one i shud submit form
and on clicking another i should go to another jsp and get data there and
upon hitting submit in that jsp I should come to my first jsp.
how can i achive it. Presently i have make both the buttons as submit type.
but i don't know how i can pass the information which will help me in doing
two different tasks using these two different buttons.
thanks.
Imran
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org