|Apache Struts 2 Documentation > Home > FAQs > Cookbook > Multiple Submit Buttons|
Often, we have multiple submit buttons within a single form. The below is just a simple way of identifying which button was clicked, and which actions to take.
The boolean properties 'submit' and 'clear' will be set to 'true' or 'false' according weather the submit or clear form element is present in the submitted form.
In this case, the properties are boolean, therefore the values set would be boolean.
There is another method, using String properties, described below...
In this case, the properties are String, therefore the values set are also String in nature.
I don't really like this method, as it ties in the Action to the Form. (What happens if you want different text to show up on the button ? You would have to change both the form as well as the corresponding action.)
There are other ways to achieve the same functionality. There are pros and cons to each methods. Feedback welcome.