各位前辈,小弟新学struts,一直被404错误困扰,WEB-INF/lib下引用了
struts-2.1.6-all.zip中apps下lib中的9个包
web.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Struts Blank</display-name> <filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter> <filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list></web-app>但是我随便用一个*.jsp页面运行时出现404,而我把<filter> 和 <filter-mapping>去掉后,就可以运行成功,
用struts-2.1.6-all.zip/apps/struts2-blank-2.1.6.war放到Apache下也是404错误
struts-2.1.6-all.zip中apps下lib中的9个包
web.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Struts Blank</display-name> <filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter> <filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list></web-app>但是我随便用一个*.jsp页面运行时出现404,而我把<filter> 和 <filter-mapping>去掉后,就可以运行成功,
用struts-2.1.6-all.zip/apps/struts2-blank-2.1.6.war放到Apache下也是404错误
解决方案 »
- 在线考试系统 在线人数问题
- 请教一个关于JS校验数值的问题
- extjs获取list数据的问题
- 条形码用扫描枪后数据怎么进入我的web页的文本框里?
- 问一个JSP数组内容传递进javascript数组的问题,请做过的高手指点!!
- tomcat5.0突然启动不了?
- 高分求救!一个类似XML的文件格式的读取问题....
- 关于Tomcat下显示word文档的问题
- 小儿科问题:大家好,我的applet小程序不能在浏览器中显示,请问这是为什么?
- 一個好難好難的問題 想了好久了 求大神幫忙解答 謝謝
- response.sendRedirect的问题,转到mms协议
- 请教excel表导入oracle数据库时以遇到某一列为空值时,那一行就导不进去啦?在线等待。。。
换成这个
org.apache.struts2.dispatcher.FilterDispatcher
试试看呢!
1:是由配置文件的编码造成。最好一概采用UTF-8来生成文件2:是由于插件包导致。删除多余的包即可。struts 主要需要如下几个包struts2-core-2.1.6.jarxwork-2.1.2.jarognl-2.6.11.jarfreeer-2.3.13.jarcommons-logging-1.1.jarcommons-io-1.3.2.jarcommons-fileupload-1.2.1.jar参考下这个http://d.download.csdn.net/down/1051203/fykyx5212
2>web.xml中最好不能有空格。 这是我用的web.xml,你尝试一下。<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <!-- ようこそ画面 -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list></web-app>
小弟问题解决了:
是tomcat5.0与struts2.1.6有点冲突
Provider org.apache.xalan.processor.TransformerFactoryImpl not found
把/tomcat/common/endorsed/(xercesImpl.jar和xml-apis.jar)换成xalan-j_2_7_1中的serializer.jar、xalan.jar、xercesImpl.jar、xml-apis.jar、 xsltc.jar就可以了