| Author |
multiple actions for a single form without using javascript
|
aryan malhotra
Greenhorn
Joined: Dec 05, 2006
Posts: 11
|
|
|
in jsp form i have 2 buttons previous and submit and 2 seperate action classes for the 2 buttons .how should i proceed.how can i have multiple actions associated with a single form .also i cant use javascript
|
 |
RoshaniG Gopal
Ranch Hand
Joined: May 15, 2006
Posts: 180
|
|
Hi Aryan, I think it would be better if you use LookUpDispatchAction for the problem that you are facing. http://struts.apache.org/1.x/struts-extras/apidocs/org/apache/struts/actions/LookupDispatchAction.html It will be helpful where you have multiple buttons on the JSP. Hope it helps.
|
Regards,<br />Roshani
|
 |
aryan malhotra
Greenhorn
Joined: Dec 05, 2006
Posts: 11
|
|
|
Thank you for the information ....................i will try it out
|
 |
Mandar Velankar
Ranch Hand
Joined: Jul 31, 2006
Posts: 32
|
|
LookupDispatchAction will be used by using reverse lookup against resource bundle properties file to find out method to be called , but it required that methods to be in same action class according to my knowledge , according to condition written in question you should have two classes , it force you to have two different action mapping associated with each action class, according to me best way is to write one routing action class and action mapping associate with it , so that when you submit page , execute method in this class should be called within that you check value of parameter property associated with both submit buttons(previous & submit) and according to value of the property , you can route your control to corresponding separate action required. e.g your JSP would have the following format for submit buttons: <html:form action="/test"> <html:submit property="method"> <bean:message key="button.add"/> </html:submit> <html:submit property="method"> <bean:message key="button.delete"/> </html:submit> </html:form> Try it out. Regards Mandar Velankar
|
 |
Mattia Merenda
Ranch Hand
Joined: Dec 14, 2006
Posts: 47
|
|
Hi, I need also to put 2 buttons in my form.But the goals of the 2 buttons are different.In fact,one button must open a page where I want to show the results of the table where I make the research with the parameters of my form.For example,I want to show the votes of the students in one subject.With the second button I'd like to open a page where I want to show particular results.For the previous example,I'd like to show in this page the average vote of every student in the subject and the overall average vote for this subject. So,while I was reading the page of the link in this topic I wondered if I can also use the LookupDispachtAction.If it possible,should I create 2 different execute() methods in my Action class that extends LookupDispachtAction? Thanks,MAttia.
|
 |
Mattia Merenda
Ranch Hand
Joined: Dec 14, 2006
Posts: 47
|
|
Hi, I need also to put 2 buttons in my form.But the goals of the 2 buttons are different.In fact,one button must open a page where I want to show the results of the table where I make the research with the parameters of my form.For example,I want to show the votes of the students in one subject.With the second button I'd like to open a page where I want to show particular results.For the previous example,I'd like to show in this page the average vote of every student in the subject and the overall average vote for this subject. So,while I was reading the page of the link in this topic I wondered if I can also use the LookupDispachtAction.If it possible,should I create 2 different execute() methods in my Action class that extends LookupDispachtAction? Thanks,MAttia.
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
Mattia, I don't know enough about your application to make specific suggestions, but from what I can tell, either DispatchAction or LookupDispatchAction might be a good fit for this situation. Start with reading tips 2 and 3 from This link. That should give you a good understanding of how to use these classes. If after reading these links you still have questions, let us know.
|
Merrill
Consultant, Sima Solutions
|
 |
rezaul prodhani
Greenhorn
Joined: Oct 28, 2009
Posts: 1
|
|
aryan malhotra wrote:in jsp form i have 2 buttons previous and submit and 2 seperate action classes for the 2 buttons .how should i proceed.how can i have multiple actions associated with a single form .also i cant use javascript
|
 |
 |
|
|
subject: multiple actions for a single form without using javascript
|
|
|