• 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

Action set for submit button

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I have jsp page its contain two button and in form action i given first button path if i press second button it have to go another path how to do please help me
 
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds llike something which would sit better in the Swing Forum.

Moving . . .
 
Campbell Ritchie
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Create a class which implements ActionListener, with the path as a private field (most likely in the form of a String, or just maybe a java.io.File).
You can use the path in the actionPerformed() method.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Campbell Ritchie:
Sounds llike something which would sit better in the Swing Forum.

Moving . . .


I think you missed the "jsp page" part

Moving once more.

As for a solution, do JSP pages get the button that was pressed in the request like PHP does? In PHP, if you have a button called "button1" with value (and label) "First" and a button called "button2" with value "Second", the POST / GET data will contain a key-value pair of button1-First if the first button is pressed, and button2-Second if the second button is pressed. You can use this to find the difference, but you will have to do it in the same page. As far as I know, you cannot have one form go to two different pages.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We're gonna give the OP whiplash, but this really belongs in the HTML/JavaScript forum. Moving one more time... please keep your arms and legs inside the carriage at all times...
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Making sure that your second button is not a submit button, establish an onclick handler that sets the action of the form to your second path, then submits the form under script control.
 
reply
    Bookmark Topic Watch Topic
  • New Topic