使用Struts时,遇到的问题:does not contain handler parameter named method . this may be caused by whitespace in the label text.异

zsy_gemini 2007-07-05 04:16:19
我做的一个报表系统现在是试运行阶段:
之前是没有什么问题的.
但是 最近我看到 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')"/>

我为了 让一个表单实现多个功能 ,所以用JS改变 表单提交是的 action 动作.
JS代码:
function set( target){
var form = document.forms[0];
form.action.value=target;
}


配置文件:
<action path="/..."
type="com....."
name="B201Form"
parameter="action"
scope="request"
validate="false" ...

在Action类里面确实有 'pass'和'toExcel'方法.

我之前测试这个系统的时候 没有遇到过这样的问题 但是现在在客户那里试运行了,我在logs 文件里面看到有这样的问题,却找不出是什么原因(不知道是不是因为现在用的人多了).
虽然客户那边没有反映这个问题(可能是这个问题出现的次数不是很多,有的用户懒得反映,他们也不知道怎么反映吧),但问题确实是存在的,想找出原因,希望大家帮帮忙!

...全文
9083 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
志有 2011-03-02
  • 打赏
  • 举报
回复
action方法中必须有
(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response)
这四个参数
KingVincy 2010-11-05
  • 打赏
  • 举报
回复
我的是由于:<html:form action="/DisneyOrderStatusAction.do"></html:form> 引起的。
因为编辑器默认把 </html:form> 带出来,所以其它就没有包含在form 中。
house802 2010-07-23
  • 打赏
  • 举报
回复
Action[/jobAction] does not contain method named findDepartment
我也出现这种情况了,用你们说白办法都解决不了,findDepartment方法我是后来加上的,jobAction里的其他方法就能找到,就是这方法找不到,但我的确的写在里边了!~
public ActionForward findDepartment(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
int id = Integer.parseInt(request.getParameter("id")); // departmentid

List<Job> result=JobImpl.getInstance().getJobByDepartId(id);
request.setAttribute("joblist", result);
response.sendRedirect(request.getContextPath()+"/operatorAction.do?action=addInit&id="+id);
return null;
}
zhengxuexfxy 2010-06-12
  • 打赏
  • 举报
回复
谢谢你,很有用,我将提交方式设为post后,就没有错误了
lingzhi123 2010-06-04
  • 打赏
  • 举报
回复
太感谢了!
我郁闷了一上午了!
我还以为是配置文件的错误。
zhaoyou_xt 2010-05-26
  • 打赏
  • 举报
回复
楼主你解决了吗?
上面说的两种方法我都没有效果,更奇怪的是,我用Ie firefox 都没有问题,只有chrome才有这个错误,但是页面又正常显示了。只是服务器端报错误?真奇怪!
worm-wei 2010-03-30
  • 打赏
  • 举报
回复
灰常感谢,呼呼
deng_1987 2009-10-15
  • 打赏
  • 举报
回复
我如果没有表单提交呢?
直接在网页上输如*.do。。遇见这种问题怎么办?
DDY110 2009-09-01
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 waght 的回复:]
把form表单的method改成post就行了。
[/Quote]

呵呵我 的也是这样解决的 谢谢了
waght 2008-07-12
  • 打赏
  • 举报
回复
把form表单的method改成post就行了。
zachsyin 2008-07-06
  • 打赏
  • 举报
回复
问题是怎么解决的啊???
zsy_gemini 2007-07-08
  • 打赏
  • 举报
回复
我找到问题了
感谢~~~~
java_new_comer 2007-07-05
  • 打赏
  • 举报
回复
哦,我知道哪里错了。
js要改变一个隐藏域的值要通过id属性来改变的。插入一个id属性:
<input name="action" value="pass" id="action" type="hidden" />


如果再行,就再改js:
function set( target){
document.getElementById("action").value=target;
document.forms[0].submit();
}
java_new_comer 2007-07-05
  • 打赏
  • 举报
回复
可能是js和button的动作冲突了。
<input type="submit" name="Submit" value="toExcel" onClick="set('toExcel')"/>
这里,既提交了表单,又想改变action域的值,你确定提交表单动作是在改变域值之后么?
建议楼主这样写:
<input type="button" name="Submit" value="toExcel" onClick="set('toExcel')"/>


function set( target){
var form = document.forms[0];
form.action.value=target;
document.forms[0].submit();
}
笔记本的风扇控制 ---------------------------------------- 09 November 2006. Summary of changes for version 20061109: 1) ACPI CA Core Subsystem: Optimized the Load ASL operator in the case where the source operand is an operation region. Simply map the operation region memory, instead of performing a bytewise read. (Region must be of type SystemMemory, see below.) Fixed the Load ASL operator for the case where the source operand is a region field. A buffer object is also allowed as the source operand. BZ 480 Fixed a problem where the Load ASL operator allowed the source operand to be an operation region of any type. It is now restricted to regions of type SystemMemory, as per the ACPI specification. BZ 481 Additional cleanup and optimizations for the new Table Manager code. AcpiEnable will now fail if all of the required ACPI tables are not loaded (FADT, FACS, DSDT). BZ 477 Added #pragma pack(8/4) to acobject.h to ensure that the structures in this header are always compiled as aligned. The ACPI_OPERAND_OBJECT has been manually optimized to be aligned and will not work if it is byte-packed. Example Code and Data Size: These are the sizes for the OS- independent acpica.lib produced by the Microsoft Visual C++ 6.0 32- bit compiler. The debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: Non-Debug Version: 78.1K Code, 17.1K Data, 95.2K Total Debug Version: 155.4K Code, 63.1K Data, 218.5K Total Current Release: Non-Debug Version: 77.9K Code, 17.0K Data, 94.9K Total Debug Version: 155.2K Code, 63.1K Data, 218.3K Total 2) iASL Compiler/Disassembler and Tools: Fixed a problem where the presence of the _OSI predefined control method within complex expressions could cause an internal compiler error. AcpiExec: Implemented full region support for multiple address spaces. SpaceId is now part of the REGION object. BZ 429 ---------------------------------------- 11 Oc

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧