码迷,mamicode.com
首页 > 其他好文 > 详细

struts2.5框架使用通配符无效问题

时间:2017-09-07 19:24:46      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:需要   path   upd   led   space   代码   struts   action   map   

错误:

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

struts2.5框架使用通配符无效问题

标签:需要   path   upd   led   space   代码   struts   action   map   

原文地址:http://www.cnblogs.com/ShawnYang/p/7490950.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!