• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

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: 74341
334
  • 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: 74341
334
  • 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: 22504
122
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: 67595
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: 67595
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