I have a fragment of HTML page with one form and 2 button:
You can know which submit button has been clicked and then act upon the button Here is the code
String btnName = request.getParameter("action"); if(btnName.equals("save")) // you code.... else if(btnName.equals("cancel")) // you code....