This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
You can use a hidden field for this purpose. Just assign a unique value to every button and pass that value to that hidden field, on button click. Check that hidden/parameter on your server and you will know which button was actually pressed.
One is to give all of your buttons the same name. If you do so, only the one clicked will be sent to the server.
Then in your servlet code, you can read parameter and branch on it's value.
The problem with this approach is that your controller logic is dependent on your view (look and feel). At some point a client, manager, or web designer will want the buttons to say "save" instead of "enter". At this point, you will need to change your logic in the servlet to match the value of the buttons.
For this reason, I prefer to give each button a separate name and test to see which is not null in the servlet.
Then in the servlet.
Now management can change the value of the buttons till their heart's content without breaking your servlet code.
The third option, which D Rog mentioned, is to use input fields of type "image". The visible part of an image tag is the image itself or whatever is in your "alt" attribute if the image can't be found. If you're using images, you can give them all the same name and read the value like in the first example. The value never gets printed to the page so there is no need for anyone to change it. [ August 03, 2005: Message edited by: Ben Souther ]
Yet another option is to not switch on the server side at all. If you like to keep the server-side code as UI-unbound as possible, I'd have each button submit to a completely different action rather than having a single action that needs to act as a traffic cop depending upon the button name.