zoukankan      html  css  js  c++  java
  • struts2.5框架使用通配符无效问题

    错误:

    Struts has detected an unhandled exception: 
    
    Messages: There is no Action mapped for namespace [/person] and action name [update] associated with context path [/struts2_04]. 
     
    

      解决方法:

        不知道从哪个版本开始,action中添加了 allowed-methods 标签,所以要想让对应Action类中的方法能进行匹配,还需要在 allowed-methods 标签注册该方法才行,比如Action中有 saveUser 和 updateUser 方法,配置如下:

    		<action name="*" class="com.shawn.action.UserAction" method="{1}User">
    			<result name="success">/{1}User.jsp</result>
    			<allowed-methods>saveUser,updateUser</allowed-methods>
    		</action>
    

      

    总结:struts 2.5 使用通配符调用方法时,内部会验证是否允许访问该方法,所以要加上

    <allowed-methods>方法名1,方法名2…</allowed-methods>代码。

  • 相关阅读:
    10.18
    10.16~10.17笔记
    JS
    10.8~10.11
    9.28~9.29
    9.27 代码笔记
    代码复习(9.26)
    9.19 链家
    9.18笔记
    9.17 定位
  • 原文地址:https://www.cnblogs.com/ShawnYang/p/7490950.html
Copyright © 2011-2022 走看看