日期:2014-05-20  浏览次数:20679 次

使用Struts时,遇到的问题:does not contain handler parameter named method . this may be caused by whitespace in the label text.异
我做的一个报表系统现在是试运行阶段:
之前是没有什么问题的.
但是   最近我看到   Tomcat的   logs文件里面记录了这样的异常:
javax.servlet.ServletException:   Request[/B201]   does   not   contain   handler   parameter   named   'action '.     This   may   be   caused   by   whitespace   in   the   label   text.
at   org.apache.struts.actions.DispatchAction.unspecified(DispatchAction.java:222)
at   org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:256)
at   org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
at   org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at   org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at   org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at   org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at   javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at   com.wedz.struts.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:21)
at   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at   org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at   org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at   org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at   org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at   org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at   org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at   org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at   org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at   org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at   org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at   org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at   java.lang.Thread.run(Unknown   Source)

我在网上查过,有几种说法:
一种是说:出现(does   not   contain   handler   parameter   named   'method '.     This   may   be   caused   by   whitespace   in   the   label   text.)的问题,是在表单FROM里如果把POST和GET搞错了会有这种错误
另一种是说:出现这个异常的原因是,jsp页面上配置了如下的句子:
<html:hidden   property=“method“   value....>
这2种说法   都没有说原因.

我的   JSP文件里是这样的:
<form     name= "B201Form "   method= "post "   action= "/.... ">
<input   name= "action "   value= "pass "   type= "hidden "   />

          ......
<input   type= "submit "   name= "Submit "   value= "pass "   onClick= "set( 'pass ') "   />
<input   type= "submit "   name= "Submit "   value= "toExcel "   onClick= "set( 'toExcel ') "/>