aspose file tools*
The moose likes JSP and the fly likes Two forms with two submit buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Two forms with two submit buttons" Watch "Two forms with two submit buttons" New topic
Author

Two forms with two submit buttons

Josh Theisen
Ranch Hand

Joined: Sep 23, 2011
Posts: 31
Hey guys ... The school year has started again, so that means I'll probably be back here!
I'll cut to the chase: I have two forms in a single .jsp file. I'd like to make it so that if I hit one button, it'll do some java. If I hit the other one, it'll do the other stuff. Right now, whenever I hit one button, it does everything.

Here's what the .jsp file looks like so far. At the bottom of the page I'll "highlight" where I think I need to work.



Here is the first form:


I need to make it so that when I hit that submit button, only this code here is called:



If you guys want any more information, I'll gladly give it. Been working on this for a while now and just can't seem to get anywhere.
Thanks everyone.
Josh Theisen
Ranch Hand

Joined: Sep 23, 2011
Posts: 31
Going to make a separate reply here since I think this will help clear up what I need it to do. For each of the form buttons, I would need something like this.



Notice that the very first line gets the parameter name. However, from the little reading I've done, request.getParameter won't work for forms - only inputs.
R. Jain
Ranch Hand

Joined: Aug 11, 2012
Posts: 370
    
    1

Josh Theisen wrote:from the little reading I've done, request.getParameter won't work for forms - only inputs.

Well, then you need to re-read the stuff you read.. It will work for any form components..
R. Jain
Ranch Hand

Joined: Aug 11, 2012
Posts: 370
    
    1

Josh Theisen wrote:Going to make a separate reply here since I think this will help clear up what I need it to do. For each of the form buttons, I would need something like this.

Have you tried to run this code?? I think this would work..
Josh Theisen
Ranch Hand

Joined: Sep 23, 2011
Posts: 31
R. Jain wrote:


I did try that code and it didn't work. However, I fixed the problem by simply adding a name to the
input submit button and called a .getParameter on that. Thanks!
 
 
subject: Two forms with two submit buttons