aspose file tools*
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
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "using multiple submit buttons" Watch "using multiple submit buttons" New topic
Author

using multiple submit buttons

Rakesh Keerthi
Ranch Hand

Joined: Jul 16, 2012
Posts: 136
Hi,
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.




Thanks,
Rakesh

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.

Thanks,
Rakesh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using multiple submit buttons