• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

multiple actions for a single form without using javascript

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
aryan malhotra
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the information ....................i will try it out
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic