DispatchAction使用时碰到的问题
jsp页面的代码:
<html:form action="/testCase">
<html:hidden property="action" value="update" />
<html:submit/><html:cancel/>
</html:form>
struts-config 中的配置:
<action
attribute="testCaseForm"
input="/jsps/testCase.jsp"
name="testCaseForm"
path="/testCase"
scope="request"
parameter="action"
type="com.sf.struts.action.TestCaseAction">
</action>
action中的代码
public class TestCaseAction extends DispatchAction {
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
TestCaseForm testCaseForm = (TestCaseForm) form;
System.out.println("execute");
return mapping.findForward("USERLOGIN");
}
public ActionForward update(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
TestCaseForm testCaseForm = (TestCaseForm) form;
System.out.println("update");
return mapping.findForward("USERLOGIN");
}
}
期望出现 "update",但最终总是打印出execute,实在想不通怎么回事,请有经验的高手指教!