does not contain handler parameter named 'method'. This may be caused by whitespace in the label text.异常及其解决方案

Dispatch时产生了这个异常:does not contain handler parameter named ‘method’ This may be caused by whitespace in the label text

DispatchActio E org.apache.struts.actions.DispatchAction  Request[/messageAction] does not contain handler parameter named 'method'.  This may be caused by whitespace in the label text.
出现这个异常的原因是,jsp页面上配置了如下的句子:
<html:hidden property=“method“ value....>

这是以前的一篇文章,今天发生的异常和这个有相似之处:
[Request[/requisitionAction] does not contain handler parameter named &#39;act&#39;.  This may be caused by whitespace in the label text.]:javax.servlet.ServletException: Request[/requisitionAction] does not contain handler parameter named 'act'.  This may be caused by whitespace in the label text.

经我分析,原因有以下几点,因为我用了lookupdispatch,所以就在这方面谈谈:
原因1:类似下面的错误用法:
             <html:button property="act" styleClass="buttons" οnclick="completeWorkItem">
              <fmt:message key="CreateApplyForm.addLight"/>
            </html:button>
js如下:
function completeWorkItem(){
  var userForm = document.forms[0];
  if(!dataCheck()) return false;
  if( window.confirm(" ")){
     addDSOXML(); 
     addLight(); 
     userForm.submit(); return true;
  }
  return false;
}

因为act=value再映射到key,由key 再映射到方法名,在jsp页面中,除过提交(submit),别的只能通过包含act=value(act是struts里配的parameter)的url来实现,但是在提交中,可以这么做:
                 <html:submit property="act" styleClass="buttons" οnclick="completeWorkItem();">
                  <fmt:message key="AttachBizForm.submit"/>
                </html:submit>
也就是说,只要将property指定为act把value在资源文件中按照上述映射即可,不用去指定act=value
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值