I have a jsp page that contains a form. In the form i have several fields and buttons. I am able to get the values from the fields but now I also want to know witch button that was pressed. How do I do that? /Jle
Assuming that the buttons are of type "submit", the easiest way is to just give them all the same name with differing values as in:
You will get a single request parameter named "theButton" which will have the value of the clicked button as its value. However, since the values are visible (they serve as the caption of the button), you may not be able to have unique values (if all the buttons need to be captioned "OK", for example). In this case you could use unique names for each of the buttons and look through the list of request parameters to see which one got submitted. If your buttons are not submit buttons, you might have to resort to a small bit of JavaScript. hth, bear [ March 17, 2003: Message edited by: Bear Bibeault ]