相关疑难解决方法(0)

web.xml中的多个URL模式元素

可以在J2EE Web应用程序版本2.4兼容的web.xml中的元素中包含多个元素,如下所示:

<filter-mapping>
    <filter-name>SomeFilter</filter-name>
    <url-pattern>*.htm</url-pattern>
    <url-pattern>*.do</url-pattern>
</filter-mapping>
Run Code Online (Sandbox Code Playgroud)

我从这里查看了XSD"web-app_2_4.xsd"文件:http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ,定义如下:

  <xsd:complexType name="filter-mappingType">
    <xsd:annotation>
      <xsd:documentation>
            some documentation here
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence>
      <xsd:element name="filter-name"
           type="j2ee:filter-nameType"/>
      <xsd:choice>
    <xsd:element name="url-pattern"
             type="j2ee:url-patternType"/>
    <xsd:element name="servlet-name"
             type="j2ee:servlet-nameType"/>
      </xsd:choice>
      <xsd:element name="dispatcher"
           type="j2ee:dispatcherType"
           minOccurs="0" maxOccurs="4"/>
    </xsd:sequence>
    <xsd:attribute name="id" type="xsd:ID"/>
  </xsd:complexType>
Run Code Online (Sandbox Code Playgroud)

URL模式定义如下所示:

所以我认为,我们可以在元素中包含多个元素.然而,我的Eclipse IDE似乎不同意我的观点,并期望有一个"调度程序"标记.

见图: Eclipse错误

eclipse web.xml java-ee

8
推荐指数
2
解决办法
2万
查看次数

标签 统计

eclipse ×1

java-ee ×1

web.xml ×1