• 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

How to go to particular method in Action class when i click the submit button in Jsp?

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

In my jsp am having 3 submit buttons, If i click one submit button it should go to the particular method in the Action class and display the data that is hard coded data in the Action class. If i click second submit button it should go to that particular method in the Action class and display the data that is hard coded data in the Action class etc. How can i go to the particular method in Action class from the jsp when i click submit button? Please give me some suggestions..

Thanks,
Vidya
 
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here JavaScript helps you using js identify which action has selected and call the respective action.
 
Ranch Hand
Posts: 55
Mac Hibernate Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To deal with the above scenario struts1 provides two classes DispatchAction and LookupDispatchAction.
Refer to the below mentioned link for details(For DispatchAction):
Click Here
If you need any further explanation reply back.

Regards,
Sandy
 
Sandy Chatterjee
Ranch Hand
Posts: 55
Mac Hibernate Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its not a good practice to use javascript.
As javascript can be disabled in clients web browser.
 
Vidya Gupta
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Actually am having a small doubt, we normally write <form action="someaction"> tag in the jsp..
That means after submitting the form it will go to the particular action which is specified in the "action" attribute.
Am i right? If so, in my newly created jsp am having 3 submit buttons. When creating each submit button ill write "onclick="some javascript function to go to particular action class".
Now on clicking each submit button it will go to particular action method that is specified in the onclick attribute..
Now my doubt is what should i write in the action attribute of form which containing 3 submit buttons?
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi vidya,
Yes, your right and this is a not a small doubt also.
If you go through the documentation then may be you get your answer so easily.
So please once go to struts documentation and search struts predefined classes.
There are two classes that is DispatchAction and LookUpdispatchAction class which is help you to clear your doubt.

Thank you.
 
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic