DispatchAction:
public class ABCAction extends DispatchAction{
public ActionForward addABCComments(
ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
public ActionForward addXYZComments(
ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
JSP Page:
<a href="#P" class="actionButtonUp" id="addComment" onclick="document.forms[0].action='addRequestComment.do?method=addABCComments';document.forms[0].submit();"/>
<bean:message key="common.btn.add" bundle="gtem"/>
</a>
In the jsp page as part of request parameter we had added method, which we define in action-mapping as part of parameter attribute.
<a href="#P" class="actionButtonUp" id="addComment" onclick="document.forms[0].action='addRequestComment.do?method=addXYZComments';document.forms[0].submit();"/>
<bean:message key="common.btn.add" bundle="gtem"/>
</a>
struts-config:
<struts-config>
<form-beans >
<form-bean name="RequestForm" type="com.ram.guru.form.RequestForm"/>
</form-beans >
<action-mappings >
<action
path="/app/addRequestComment"
attribute="RequestForm"
name="RequestForm"
scope="request"
validate="false"
input="/jsp/request/jsp/Request.jsp"
type="com.ram.guru.action.request.ABCAction"
parameter="method">
<forward name="success" path="/jsp/request/jsp/Request.jsp" />
</action>
</action-mappings >
<global-exceptions />
<data-sources />
</struts-config>