写个Action继承DispatchAction:
public class DoNothingAction extends DispatchAction {
public ActionForward add(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
System.out.println("ADD method was invoked.");
return mapping.findForward("index");
}
public ActionForward update(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
System.out.println("UPDATE method was invoked.");
return mapping.findForward("index");
}
}
struts-config.xml中配置:
<action path="/doNothing" type="com.yourcompany.struts.action.DoNothingAction"
parameter="method"
scope="request">
<forward name="index" path="/index.jsp"></forward>
</action>
页面调用:
<a href="doNothing.do?method=add">Execute ADD method</a><br>
<a href="doNothing.do?method=update">Execute UPDATE method</a>