This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes using multiple submit buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "using multiple submit buttons" Watch "using multiple submit buttons" New topic

using multiple submit buttons

Rakesh Keerthi
Ranch Hand

Joined: Jul 16, 2012
Posts: 136
i have multiple Submit buttons on myjsp and the correspond to different servlets. could any one advice me how to map them correctly to correct servlet and also to perform the javascript for each(if assigned). below is the code that i used.


Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

*move all scriptlet code to a java class.

Coming to your question:
there are two ways, what i can think of ,

1. call a javascript function by passing a value onclick,
then construct servlet path according to JS function parameter and submit.

2. without javascript, just call a servlet there you get the value of submit button,
now you forward to appropriate servlets.
Rakesh Keerthi
Ranch Hand

Joined: Jul 16, 2012
Posts: 136
Thank you Venkataswamy, if you don't mind could you please post a sample code for both the mentioned methods, just the redirecting path is enough, so that, i can get an idea about how to do it.

jQuery in Action, 2nd edition
subject: using multiple submit buttons
Similar Threads
Compare textbox data with sql table data
How to update a image using servlet?
Oracle table takes Null
spaces while populating using s:iterator
Please help me regarding the forms selection