java - How to find out which HTML button was pushed in my servlet? -


I am creating a registration form with two submit buttons. I should know what button was clicked in my servlet code is? Read the answers for

.

Then, in

  string button 1 = request.getParameter ("button1"); String button 2 = request.getParameter ("button2");  

The value that is not pressed is the button pressed.

Or, if you want to use the same name for two buttons, then you can set a different value

  & lt; Input type = "submit" name = "act" value = "delete" /> & Lt; Input type = "submit" name = "act" value = "update" />  

then

  string act = request. Jack parameter ("work"); If (act == empty) {// no button has been selected} and (if act.equals ("delete")) {// delete button was pressed} and if (act.equals ("update")) {/ UPDATE button was pressed} and {// somebody changed the HTML and sent a different price! }  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -