How to handle handling multiple buttons in HTML Form?

Handling Multiple Buttons in HTML Form

You have to use a variation of the as shown below to tackle this problem.

<html:submit property=step>
<html:submit property=step>
<bean:message key=button.delete"/>

In the Message Resource = Save Me;
button.delete = Delete

you have to add a variable named step in the ActionForm and then add two methods getStep() and setStep() In the execute() method.

Public ActionForward execute (ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception
CustomerForm custForm = (CustomerForm) form;
ActionForward forward = null;
if (“Save Me”.equals(custForm.getStep()) ) {
System.out.println(Save Me Button Clicked);
} else if(“Delete”.equals (custForm.getStep ())) {
System.out.println (Delete Button Clicked);
return forward;

Related Topic Difference between DispatchAction and LookupDispatchAction?
Multiple buttons in Struts using JavaScript
The List of Most Popular Blog Widgets
Android's Bluetooth Inbound and Outbound Transfer
What are all the Versions of HTML and XHTML
Struts © 2011   Privacy Policy  Terms of Service  Feedback