【问题标题】:What's wrong with this web.xml file? The content of web-app must match [duplicate]这个 web.xml 文件有什么问题? web-app的内容必须匹配[重复]
【发布时间】:2014-12-13 06:08:56
【问题描述】:

以下web.xml文件

<!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>My Web Application</display-name>


    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>


    <filter>
        <filter-name>dispatcher</filter-name>
        <filter-class>org.javalite.activeweb.RequestDispatcher</filter-class>
        <init-param>
            <param-name>exclusions</param-name>
            <param-value>css,images,js</param-value>
        </init-param>
        <init-param>
            <param-name>root_controller</param-name>
            <param-value>home</param-value>
        </init-param>
    </filter>


    <filter-mapping>
        <filter-name>dispatcher</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

</web-app>

让 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*)".

即没有强制性标签。

不喜欢什么?

更新

如果我同时删除 filterfilter-mapping 标签,错误就会消失。不幸的是,我需要它们,但无法删除。

【问题讨论】:

    标签: eclipse web.xml


    【解决方案1】:

    元素的顺序必须与错误消息中列出的顺序一致。尝试将 filterfilter-mapping 元素放在 session-config 元素之前。

    【讨论】:

      猜你喜欢
      • 2012-09-10
      • 2020-09-05
      • 2011-08-08
      • 1970-01-01
      • 2016-12-08
      • 2016-10-08
      • 2016-02-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多