在完成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>