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 reportmessage 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.
在线等。急急急!!!!!!!!!!!!!!!!!
<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 reportmessage 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.
在线等。急急急!!!!!!!!!!!!!!!!!
感觉自己写工程没必要设namespace
<form action="test/hello.action">
<input type="submit" value="xxx">
</form>
把 namespace="/test"去掉,然后<form action="hello.action">
</form>这样肯定行的。
这样看了吗?
tomcat发布时这样了
Exception starting filter filter
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:249)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4340)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1105)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1203)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
at java.lang.Thread.run(Thread.java:619)愁人啊
而在web.xml中我使用的是org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter进行初始化
非常感谢热心的各位
给分的话就结贴。