How can I distinguish b/w 2 buttons which are submitting the same form from within my JSP page? I'd like to solve this problem without using JavaScript.

Christopher Schultz

You can give the buttons names:

<form method="POST" action="...">

<input type="submit" name="ok" value="ok" src="ok.gif" />
<input type="submit" name="cancel" value="cancel" src="cancel.gif" />

Now, when the form submits, you can check to see if "ok".equals(request.getParameter("ok")). I think you can also give the buttons the same name, and just check the value to see which one was clicked.

If you want to use images for your submit buttons, you'll have to check the ok.x and ok.y variables, since a submit for an image button doesn't return a value for ok, but the X and Y coordinates that you clicked when submitting.

None of this requires JavaScript.