struts2 新增请求无法访问到Action中的方法

来源:互联网 发布:淘宝兼职 刷单怎么 编辑:程序博客网 时间:2024/05/16 08:38

现象:Action 定义为通配符形式,Action中的delete,input等方法访问正常,但新加的其它方法(如a(), b())无法访问


原因:strust2 2.3以上版本增加了安全控制


解决办法:

在<action>配置中增加<allowed-methods>

<action name="a-*" class="aAction" method="{1}">
   
      …………
   
  <allowed-methods>a,b</allowed-methods>
    </action>


可参考官网:http://struts.apache.org/docs/action-configuration.html#ActionConfiguration-StrictDMI

0 0
原创粉丝点击