请问下struts配置404错误是肿么回事啊
java吧
全部回复
仅看楼主
level 11
forrest0402 楼主
[吐舌]新人求解,照着书上复制的代码啊
2013年07月30日 14点07分 1
level 11
forrest0402 楼主
我按照书上写滴配置src里头的struts.xml代码如下
<struts>
<package name="itcast" namespace="/test" extends="struts-default">
<action name="helloworld" class="cn.itcast.action.HelloWorldAction"
method="execute">
<result name="success">/WEB-INF/page/hello.jsp</result>
</action>
</package>
</struts>
web.xml如下
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
然后访问localhost:8080/HappyTimes/test/helloworld出现404错误,那个Happytimes是我工程的名字。。。然后不知道哪里错了,求指教啊,而且我发现webroot下的jsp也全部访问不了
2013年07月30日 14点07分 2
level 11
forrest0402 楼主
我把web.xml中那段filter删除就可以访问jsp了,不过书上确实有这段啊,我是直接用myeclipse添加的struts2.1支持
2013年07月30日 14点07分 4
level 11
forrest0402 楼主
Caused by:
Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/F:/apache-tomcat/webapps/HappyTimes/WEB-INF/lib/struts2-core-2.3.15.1.jar!/struts-default.xml:29:72at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:232)at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180)at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)... 20 more
Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/F:/apache-tomcat/webapps/HappyTimes/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-default.xml:29:72 - bean - jar:file:/F:/apache-tomcat/webapps/HappyTimes/WEB-INF/lib/struts2-core-2.3.15.1.jar!/struts-default.xml:29:72at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216)... 23 more
2013年07月30日 14点07分 8
jar 包问题。
2013年07月30日 15点07分
level 11
forrest0402 楼主
[乖]问题解决了,我换成myeclipse自带的tomcat就可以了,貌似我从官网下载的那个7.X和哪里哪里可能不兼容之类滴,又或者它的要求不一样[吐舌]
2013年07月31日 04点07分 15
你是学完什么学的Struts?
2013年07月31日 04点07分
1