Ayu*_*man 8 eclipse web.xml java-ee
可以在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似乎不同意我的观点,并期望有一个"调度程序"标记.
见图:

Ass*_*lov 14
显然没有,但你可以:
<filter-mapping>
<filter-name>SomeFilter</filter-name>
<url-pattern>*.htm</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>SomeFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
Run Code Online (Sandbox Code Playgroud)
默认值是1formaxOccurs和minOccursinsequence元素:
https://msdn.microsoft.com/en-us/library/ms256089(v=vs.110).aspx。
并且choice只允许其中的一个元素:
https://msdn.microsoft.com/en-us/library/ms256109 (v=vs.110).aspx
| 归档时间: |
|
| 查看次数: |
18803 次 |
| 最近记录: |