• 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>代码。

  • 相关阅读:
    初始MyBatis
    h5调用相机相册
    canvas详解
    js闭包
    Vue和React对比篇
    js造成内存泄漏的几种情况
    js合并对象
    git常用命令小结
    如何隐藏overflow: scroll的滚动条
    js数组sort排序方法的算法
  • 原文地址:https://www.cnblogs.com/ShawnYang/p/7490950.html
Copyright © 2020-2023  润新知