
Multiple buttons in struts using java script?

Hi friends,
This example defines how to create a multiple button in struts using javascript.
JSP Page :
<html:form action="/corporations.do?method=createPage" >
<tr>
<td>BookID</td>
<td><html:text property="bookID" size="20"/></td>
</tr>
<tr>
<td>BookName</td>
<td><html:text property="bookName" size="20"/></td>
</tr>
<input type="button" value="Save and Continue" name="b1" onClick="save()">
<input type="button" value="Discard Changes" name="b2" onClick="discard()">
</html:form>
In the Java Script
<script type="text/javascript" >
function save() {
document.OrganizationForm.action ="<%=request.getContextPath()%>/corporations.do?method=save";
document.OrganizationForm.submit();
}
function discard() {
document.OrganizationForm.action ="<%=request.getContextPath()%>/corporations.do?method=discard";
document.OrganizationForm.submit();
}
</script>
Thanks.