Struts2.5以上版本There is no Action mapped for namespace [/] and action name [userAction_login] associat...

分析:Struts2在2.5版本后添加strict-method-invocation(严格方法访问),默认为true,不能使用动态方法调用功能,故需设为false

struts.xml设置如下:

 1 <package name="p1" extends="struts-default" namespace="/"strict-method-invocation="false">
 2 
 3         <!--配置全局的结果视图-->
 4         <global-results>
 5             <result name="login" type="redirect">/login.jsp</result>
 6         </global-results>
 7 
 8         <!--配置jsp页面的访问规则-->
 9         <action name="page_*_*">
10             <!--1:第一个*,2:第二个*-->
11             <result name="success">/WEB-INF/pages/{1}/{2}.jsp</result>
12         </action>
13 
14         <!--用户模块-->
15         <action name="userAction_*" class="com.gyf.bos.web.action.UserAction" method="{1}">
16             <result name="home">/WEB-INF/pages/common/index.jsp</result>
17             <result name="loginfailure">/login.jsp</result>
18         </action>
19     </package>

推荐设置:namespace="/"

提示:因为SSH项目已经有很多年头了,使用时要考虑到版本问题。

 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值