I have a form in jsp. There are two submit buttons: \"Search\" and \"Add New\" button. I had set each button with their own method attribute.
Set
to
Another way is to define multiple mappings for the same Action, like
in JSP:
in Struts.xml
/example/search.jsp
/example/add.jsp
A third way is to use Wildcard Mappings.
P.S: If you go for the second one, I'll suggest, as a best practice, to use one Action for every logical action you have to perform...
If you have common data loaded / managed by both your actions, "search" and "addNew", then you can define a employeeBaseAction, extended by both employeeSearchAction and employeeAddNewAction.
It's 2014 now, and DMI usage is unanimously discouraged (today more than ever), other than pretty useless, so I strongly suggest you to use solution n.2.