Dav*_*vid 1 java jsp struts struts-1
我在struts.xml中声明了以下操作:
<action path="/updateAccountInfo"
type="org.myCompany.UpdateAccountAction"
name="myAccountForm"
scope="session"
validate="true"
parameter="method"
input="/updateAccountInfo.jsp">
<forward name="success" path="/updateAccountInfo.jsp" />
</action>
Run Code Online (Sandbox Code Playgroud)
在我的JSP页面中,我有以下形式:
<html:form action="/updateAccountInfo.do">
<input type="hidden" name="method" value="sendMessage" />
Run Code Online (Sandbox Code Playgroud)
在我的java类中,我有以下方法:
public final ActionForward sendMessage(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
System.out.println("sending");
return null;
}
Run Code Online (Sandbox Code Playgroud)
Struts不是运行sendMessage,而是调用execute方法.为什么?我的struts-config错了吗?或者我错过了另一个配置设置?
请首先确保您的操作扩展了DispatchAction.您可能不应该覆盖该类中的execute方法,因为该方法负责提取请求参数并调用相应的方法.如果覆盖执行,则此逻辑将不再执行.
| 归档时间: |
|
| 查看次数: |
8406 次 |
| 最近记录: |