Multiple submit buttons on HTML form – designate one button as default [duplicate]

The first button is always the default; it can’t be changed. Whilst you can try to fix it up with JavaScript, the form will behave unexpectedly in a browser without scripting, and there are some usability/accessibility corner cases to think about. For example, the code linked to by Zoran will accidentally submit the form on … Read more

How to detect submit button clicked in multiple submit buttons scenario in single Action class? [duplicate]

You can define two actions in struts.xml file and use action attribute of <s:submit> tag in order to submit to different actions http://struts.apache.org/docs/submit.html. In JSP: <s:submit value=”Search” action=”searchEmployeeAction”/> <s:submit value=”Add New” action=”addEmployeeAction”/> In struts.xml: <action name=”addEmployeeAction” method=”add” class=”example.EmployeeAction”> <result>/example/add.jsp</result> </action> <action name=”searchEmployeeAction” method=”search” class=”example.EmployeeAction”> <result>/example/search.jsp</result> </action> And in your action create two public String methods … Read more

Multiple submit buttons in an HTML form

I’m just doing the trick of floating the buttons to the right. This way the Prev button is left of the Next button, but the Next comes first in the HTML structure: .f { float: right; } .clr { clear: both; } <form action=”action” method=”get”> <input type=”text” name=”abc”> <div id=”buttons”> <input type=”submit” class=”f” name=”next” value=”Next”> … Read more