各位前辈,小弟新学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错误

解决方案 »

  1.   

    吧filter-class里的内容
    换成这个
    org.apache.struts2.dispatcher.FilterDispatcher
    试试看呢!
      

  2.   

    看别人说的
    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
      

  3.   

    过滤器:org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilterstruts2.1.6支持的,和他没有关系。问题所在:1>jar包引用有问题。
              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>
      

  4.   

    谢谢各位前辈指点,
    小弟问题解决了:
    是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就可以了