• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Two forms with two submit buttons

 
Josh Theisen
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 375
1
Java Python Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 375
1
Java Python Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic