public class ThirdAction extends ActionSupport {
public String test() throws Exception{
System.out.println("ThirdAction.test1()");
return SUCCESS;
}
}
/ok.jsp
访问这个url:http://localhost:8080/teststruts01/third!test
报这个错误:HTTP Status 404 - There is no Action mapped for namespace [/] and action name [third!test] associated with context path [/teststruts01].
是怎么回事啊
在struts.xml 中的package 标签行中加上namespace="/" 试试。
<package name="default" namespace="/" extends="struts-default">
<action name="first" class="com.bjsxt.struts2.FirstAction">
<result name="success">/ok.jsp</result>
<result name="error">/error.jsp</result>
</action>
<action name="second" class="com.bjsxt.struts2.SecondAction">
<result name="success">/ok.jsp</result>
<result name="error">/error.jsp</result>
</action>
<action name="third" class="com.bjsxt.struts2.ThirdAction">
<result>/ok.jsp</result>
</action>
</package>
加了还是不管用啊