Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Action set for submit button

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • 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: 71676
312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds llike something which would sit better in the Swing Forum.

Moving . . .
 
Campbell Ritchie
Marshal
Posts: 71676
312
  • Mark post as helpful
  • send pies
  • 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: 22054
113
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • 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.
 
Marshal
Posts: 67497
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • 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
Marshal
Posts: 67497
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • 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.
 
"To do good, you actually have to do something." -- Yvon Chouinard
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic