<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
  <display-name>WebRoot</display-name>
  <description>SSH项目</description>
    
  <context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>/WEB-INF/classes/log4j.properties</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>com.test.common.ApplicationResources</param-value>
  </context-param>
  
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:META-INF/config/applicationContext-*.xml,
    /WEB-INF/config_ext/applicationContext-*.xml</param-value>
  </context-param>    <filter>
   <filter-name>OpenSessionInViewFilter</filter-name>
   <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
  </filter>
  <filter-mapping>
   <filter-name>OpenSessionInViewFilter</filter-name>
   <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter> 
<filter-name>SetCharacterEncoding</filter-name> 
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> 
<init-param> 
<param-name>encoding</param-name> 
<param-value>GBK</param-value> 
</init-param>
<init-param>
      <param-name>forceEncoding</param-name>
      <param-value>true</param-value>
    </init-param> 
  </filter> 
  <filter-mapping> 
<filter-name>SetCharacterEncoding</filter-name> 
<url-pattern>*.shtml</url-pattern> 
  </filter-mapping>
  <filter-mapping> 
<filter-name>SetCharacterEncoding</filter-name> 
<url-pattern>*.do</url-pattern> 
  </filter-mapping>
  <filter-mapping> 
<filter-name>SetCharacterEncoding</filter-name> 
<url-pattern>*.html</url-pattern> 
  </filter-mapping> 
  <filter-mapping> 
<filter-name>SetCharacterEncoding</filter-name> 
<url-pattern>*.htm</url-pattern> 
  </filter-mapping> 
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
    
  <servlet>   
   <servlet-name>springReport</servlet-name>  
        <servlet-class>   
            org.springframework.web.servlet.DispatcherServlet    
   </servlet-class>
   <load-on-startup>1</load-on-startup>  
  </servlet>
  <servlet-mapping>   
      <servlet-name>springReport</servlet-name>   
      <url-pattern>*.shtml</url-pattern>   
  </servlet-mapping>
  
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml,/WEB-INF/xml_ext/struts-config-login.xml,
      /WEB-INF/xml_ext/struts-config-myarea.xml,/WEB-INF/xml_ext/struts-config-spot.xml
      </param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>3</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>3</param-value>
    </init-param>
    <load-on-startup>0</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>
  <session-config>
    <session-timeout>30</session-timeout>
  </session-config>
  <welcome-file-list>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
  <error-page>
    <error-code>404</error-code>
    <location>/404.jsp</location>
  </error-page>
  <error-page>
    <error-code>403</error-code>
    <location>/403.jsp</location>
  </error-page>
  <taglib>
    <taglib-uri>http://struts.apache.org/tags-html</taglib-uri>
    <taglib-location>/WEB-INF/tlds/struts-html.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>http://struts.apache.org/tags-bean</taglib-uri>
    <taglib-location>/WEB-INF/tlds/struts-bean.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>http://struts.apache.org/tags-logic</taglib-uri>
    <taglib-location>/WEB-INF/tlds/struts-logic.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>http://struts.apache.org/tags-nested</taglib-uri>
    <taglib-location>/WEB-INF/tlds/struts-nested.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>http://struts.apache.org/tags-nested</taglib-uri>
    <taglib-location>/WEB-INF/tlds/struts-tiles.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>   
    <taglib-location>/WEB-INF/tlds/c.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
    <taglib-location>/WEB-INF/tlds/fmt.tld</taglib-location>
  </taglib>
  <resource-ref>
   <description>DB Connection</description>
    <res-ref-name>jdbc/oracle</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>
</web-app>最后面有个红的,报错,请高手帮忙看看,谢谢

解决方案 »

  1.   

    谢谢大家的关注与提醒
    我用的是Eclipse开发工具
    报的错是
    The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)". web.xml spring/WebRoot/WEB-INF 第 149 行 149行就是最末尾的</web-app>
    旁边一个红点,我找了好久,也没找到那里没匹配。不知道是不是顺序有问题,请高手帮忙看一下。谢谢
      

  2.   

    报错一把都是 dtd有问题,去 apache或者其他工程里面找一个不会报错的 web.xml的 dtd
      

  3.   

    这段有问题 你去掉看看   <servlet>   
          <servlet-name>springReport</servlet-name>  
            <servlet-class>   
                org.springframework.web.servlet.DispatcherServlet    
              </servlet-class>
              <load-on-startup>1</load-on-startup>  
      </servlet>
      <servlet-mapping>   
          <servlet-name>springReport</servlet-name>   
          <url-pattern>*.shtml</url-pattern>   
      </servlet-mapping>
      

  4.   

    把<taglib>标签放置到<jsp-config>标签对中再在头部加上--<web-app 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"
        version="2.4">
      

  5.   


    原来如此啊,顶顶顶[code=XML]<?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:app*.xml</param-value>
    </context-param>
    <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListener
    </listener-class>
    </listener>
    <!-- 可以使用scope 为request或session的bean -->
    <listener>
    <listener-class>
    org.springframework.web.context.request.RequestContextListener
    </listener-class>
    </listener> <!-- 防止通过地址入侵 -->
    <filter>
    <filter-name>LoginFilter</filter-name>
    <filter-class>com.filter.LoginFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>LoginFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- 系统锁定 -->
    <filter>
    <filter-name>LockFilter</filter-name>
    <filter-class>com.filter.LockFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>LockFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping> <!-- spring提供的用來統一編碼的 filter-->
    <filter>
    <filter-name>characterEncoding</filter-name>
    <filter-class>
    org.springframework.web.filter.CharacterEncodingFilter
    </filter-class>
    <init-param>
    <param-name>encoding</param-name>
    <param-value>utf-8</param-value>
    </init-param>
    <init-param>
    <param-name>forceEncoding</param-name>
    <param-value>true</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>characterEncoding</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    <!-- spring提供的用来实现hibernate的opensessionInview的过滤器 -->
    <filter>
    <filter-name>openSessionInView</filter-name>
    <filter-class>
    org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
    </filter-class>
    <!-- 通过这个参数指定打开session所用到的session工厂的名字,
    如果session工厂的名字为“sessionFactory”,此参数可以不用指定
    -->
    <init-param>
    <param-name>sessionFactoryBeanName</param-name>
    <param-value>sessionFactory</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>openSessionInView</filter-name>
    <url-pattern>*.do</url-pattern>
    </filter-mapping> <filter>
    <filter-name>sitemesh</filter-name>
    <filter-class>
    com.opensymphony.module.sitemesh.filter.PageFilter
    </filter-class>
    </filter>
    <filter-mapping>
    <filter-name>sitemesh</filter-name>
    <url-pattern>*.do</url-pattern>
    </filter-mapping>



    <!-- 导出Excle表 -->
    <filter>
    <filter-name>eXtremeExport</filter-name>
    <filter-class>
    org.extremecomponents.table.filter.ExportFilter
    </filter-class>
    </filter>
    <filter-mapping>
    <filter-name>eXtremeExport</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping> <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>
    org.apache.struts.action.ActionServlet
    </servlet-class>
    <init-param>
    <param-name>config</param-name>
    <param-value>
    /WEB-INF/struts-config.xml,
    /WEB-INF/struts-config_LiuJianWei.xml,
    /WEB-INF/struts-config_JiangRenXu.xml,
    /WEB-INF/struts-config_LiZhi.xml,
    /WEB-INF/struts-config_ZhangLi.xml,
    /WEB-INF/struts-config_SuiYingYing.xml,
    /WEB-INF/struts-config_WuPeiWen.xml
    </param-value>
    </init-param>
    <init-param>
    <param-name>debug</param-name>
    <param-value>3</param-value>
    </init-param>
    <init-param>
    <param-name>detail</param-name>
    <param-value>3</param-value>
    </init-param>
    <load-on-startup>0</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
    </servlet-mapping> <servlet>
    <servlet-name>dwr-invoker</servlet-name>
    <servlet-class>
    org.directwebremoting.servlet.DwrServlet
    </servlet-class> <!-- This should NEVER be present in live -->
    <init-param>
    <param-name>debug</param-name>
    <param-value>true</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
    </servlet> <servlet-mapping>
    <servlet-name>dwr-invoker</servlet-name>
    <url-pattern>/dwr/*</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
    </welcome-file-list>
    </web-app>[/code