出现此异常的原因是 struts-config.xml 文件中 forward 节点中的name的值没有save值, jsp页面中的form表单中请求的<form action="userAction.do?action=save" method="get">action的值save 在struts——config.xml 中没有找到,就会出现这样的错误。
struts-config.xml 文件内容部分如下:---------------------
<action path="/userAction"
name="userForm"
attribute="userForm"
scope="request"
parameter="action"
type="com.cn.bireport.action.UserAction"
validate="false">
<forward name="userList" path="/userList.jsp" />
<forward name="edit" path="/modifyUser.jsp" />
<forward name="add" path="/addUser.jsp" />
</action>
</action-mappings>
------------------------
出现的具体异常如下:
avax.servlet.ServletException: Request[/userAction] does not contain
handler parameter named 'action'. This may be caused by whitespace in the label text.
org.apache.struts.actions.DispatchAction.unspecified(DispatchAction.java:222)
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:256)
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
com.cn.bireport.common.BaseAction.execute(BaseAction.java:50)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.cn.bireport.common.CharacterEncodeFilter.doFilter(CharacterEncodeFilter.java:41)
struts-config.xml 文件内容部分如下:---------------------
<action path="/userAction"
name="userForm"
attribute="userForm"
scope="request"
parameter="action"
type="com.cn.bireport.action.UserAction"
validate="false">
<forward name="userList" path="/userList.jsp" />
<forward name="edit" path="/modifyUser.jsp" />
<forward name="add" path="/addUser.jsp" />
</action>
</action-mappings>
------------------------
出现的具体异常如下:
avax.servlet.ServletException: Request[/userAction] does not contain
handler parameter named 'action'. This may be caused by whitespace in the label text.
org.apache.struts.actions.DispatchAction.unspecified(DispatchAction.java:222)
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:256)
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
com.cn.bireport.common.BaseAction.execute(BaseAction.java:50)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.cn.bireport.common.CharacterEncodeFilter.doFilter(CharacterEncodeFilter.java:41)