Q: handling multiple buttons in a form in struts I am facing an issue while handling multiple buttons in a form using struts.
I have three buttons add,delete and go .I have made forward as hidden and on click of a button i would get the name of the button.
The problem is with go button on click of that i want to call a javascript and then call the action and return to the same page .
Question is i am facing issue whicl calling javascript on click of a button and returning to the same page.Please tell me a proper way to handle multiple buttons in a form and its action

A: Well, you can implement onclick with a javascript call, and within the javascript do the real submit. 
What I do is:
javascript:
function submitMyForm() {
  var theForm = document.forms['formname'];
  // sometimes re-write the action
  // theForm.action = '<html:rewrite page="somepage.do"/>';

  theForm.submit();
}

HTML / JSP / struts
<html:submit value="Save" onclick="submitMyForm(); return false;"/>

Hope that answers some of the question.
Getting back to the same page is to either having the form submit to that page, or submit to another controller which directs back to your page.
