【异常处理】There is no Action mapped for namespace [/] and action name [Student_Query_Action] associated

在完成web大作业使用通配符*时出现错误,出错信息显示无对应Action映射。原因是Struts2从2.5版本开始默认开启严格方法调用,使用通配符*需在package中设置strict - method - invocation=“false”,而作者未设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在完成web的大作业时使用了通配符*结果出现以下情况

出错信息:There is no Action mapped for namespace [/] and action name [Student_Query_Action] associated with context path [/%E5%AD%A6%E7%94%9F%E9%80%89%E8%AF%BE%E7%B3%BB%E7%BB%9F].

原因:struts2从2.5版本开始,默认开启了严格的方法调用。如果要使用通配符*,必须在package中设置 strict-method-invocation=“false”。而我没有设置

<package name="exam" namespace="/" extends="struts-default" strict-method-invocation="false">
	
		<action name="login" class="Action.LoginAction">
			<result name="student">/student.jsp</result>
			<result name="teacher">/teacher.jsp</result>
			<result name="admin">/admin.jsp</result>
			<result name="error">/index.jsp</result>
		</action>
		
		<action name="Student_*_Action" class="Action.StudentAction" method="{1}">
			<result name="success">/student.jsp</result>
			<result name="error">/index.jsp</result>
		</action>
		
		
	</package>
	
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值