• 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

Configure multiple actions (multiple submits) in a single JSP using Struts 2

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
could someone assist me in configuring multiple submits in a single JSP using Struts 2.

I know the way its dealt in Struts 1 as in give 3 names for 3 submits (save, update, delete) and in action class instead of overriding execute() we write
3 methods (save, update, delete) with the same signature of execute method.

But i have no idea how to deal in Struts 2.

Thanks!
Jalsa
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

you can use three form and with different action name and call method as per your requirement.

In struts 2.0 it's not compulsory to override excecute() method....

As per action you can configure your action method name....

this method configure at your Struts xml configuration file...

 
Pawan Kalyan
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Nishan..

I have a concern regarding your approach.
Do we have to write our own methods in action class instead of execute() as we do in Struts 1.x ex save, delete etc with same signature of execute() ??

 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, they need to return a String, otherwise S2 won't know what result to show. I mean, the signature for a method doesn't get much simpler than execute()'s!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic