在 web.xml 檔包含 metadata-complete="true" 屬性時,Servlet 3.1 會導致處理 <absolute-ordering> 元素的方式發生變更。
在 Servlet 3.0 中,當 metadata-complete 屬性設定為 "true" 時,將會使用所有網頁片段保存檔。在 Servlet 3.1 中,會將 <absolute-ordering> 元素視為完整,從而導致未列於 <absolute-ordering> 元素內的網頁片段會從處理程序中排除。
此 Servlet 3.1 特性可能會透過排除先前包括在內的網頁片段,來變更現有應用程式行為。
如果 web.xml 檔包含 metadata-complete="true" 屬性,且 <absolute-ordering> 元素未包含網頁片段名稱項目,此規則會標示 web-fragment.xml 檔中的 <name>B</name> 元素。
下列範例將示範組合使用 web.xml 檔及 web-fragment.xml 檔時的行為變更:
web.xml:
<absolute-ordering> <name>A</name> <others/> </absolute-ordering>
web-fragment.xml:
<web-fragment> <name>B</name> </web-fragment>
在 Servlet 3.0 中,網頁片段 B 將會包括在處理程序內。在 Servlet 3.1 中,不會將其包括在內。若要將網頁片段 B 包括在處理程序內,請在 web.xml 檔中 <absolute-ordering> 元素內的適當位置新增 <name>B</name> 元素。
如需 Servlet 3.1 行為變更的相關資訊,請參閱下列資源: Servlet 3.1 行為變更。