求教struts2的配置问题
struts。xml
<struts>
<package name="h" extends="struts-default" namespace="/test">
<action name="hello" class="com.HelloStruts" method="execute">
<result name="hello">/hello.jsp</result>
</action>
</package>
</struts>
web。xml
<filter>
<filter-name>filter</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>struts</param-name>
<param-value>
WebRoot/WEB-INF/config/HelloStruts.xml
</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
为什么出现这个错误
HTTP Status 404 - There is no Action mapped for action name hello.
type Status report
message There is no Action mapped for action name hello.
description The requested resource (There is no Action mapped for action name hello.) is not available.
在线等。。。。急急急!!!!!!!!!!!!!!!!!
[解决办法]
jsp里调用的时候加namespace了么?
感觉自己写工程没必要设namespace
[解决办法]
<package name="h" extends="struts-default" namespace="/test">
把 namespace="/test"去掉,然后<form action="hello.action">
[解决办法]
- XML code
<form action="/test/hello.action">
[解决办法]
[解决办法]
[解决办法]
404没用找到路径··提交路径有问题
[解决办法]
<s:form action="hello.action" namespace="test">
</form>这样肯定行的。
[解决办法]
action="<%=request.getContextPath()%>/test/hello.action"
这样看了吗?