错误介绍:1:找不到配置的(DispatchAction)方法参数,或者其他参数。 eg:parameter=“method”;
2:过滤器中“ chain.doFilter(request,response);”传递不了下一个过滤器中或者,进入请求中。
异常详细信息:
2015-01-16 17:18:02,424 ERROR org.apache.struts.actions.DispatchAction Request[/usergetinfo] does not contain handler parameter named 'param'. This may be caused by whitespace in the label text. 2015-1-16 17:18:02 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet action threw exception javax.servlet.ServletException: Request[/usergetinfo] does not contain handler parameter named 'param'. This may be caused by whitespace in the label text. at org.apache.struts.actions.DispatchAction.unspecified(DispatchAction.java:215) at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:249) at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.ts.filter.EncodingFilter.doFilter(EncodingFilter.java:79) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:852) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:584) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508) at java.lang.Thread.run(Thread.java:619)
原因分析:
1:jsp中<form action="usergetinfo.do?param=getHtmlUserInfo">这种传递参数不能成功。
2:js中userForm.action = path+"/usergetinfo.do?param=getHtmlUserInfo";
userForm.method = "get";
userForm.submit();这种传递参数不能成功。
解决办法:
1:post:
<form action="usergetinfo.do?param=getHtmlUserInfo" method="post">...
get:
<form action="usergetinfo.do" method="get"> <input type="hidden" id="param" name="param" value="getHtmlUserInfo" />...
2:如果js(get)提交,在jsp的form表单中添加:
<!--jsp--> <input type="hidden" id="param" name="param" value="getHtmlUserInfo" /> //js userForm.action = path+"/usergetinfo.do"; userForm.method = "get"; userForm.submit();
3:如果js(post)提交,不用隐藏域,直接写:
var userForm = $("#userform").get(0); userForm.action = path+"/usergetinfo.do?param=getHtmlUserInfo";//或者userForm.action = "usergetinfo.do?param=getHtmlUserInfo"; userForm.method = "post"; userForm.submit()
注:如果,用get方式提交,<form>下submit,还是js提交,都要在form表单中添加,一个method parameter的隐藏域提交。
注:如果request找不到路径可添加:
<!--jsp--> <input id="contextPath" type="hidden" value="${pageContext.request.contextPath }" /> //js var path = $("#contextPath").val();