web.xml檔案配置的說明
Servlet2.4中web.xml配置及說明
注:以下的順序是不能錯的
原文地址:http://wenku.baidu.com/view/2397fe19964bcf84b9d57bde.html
<?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"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<!-- icon元素指出IDE和GUI工具用來表示Web應用的一個和兩個影像檔案的位置 -->
<icon>
<small-icon>/images/small.gif</small-icon><!-- 16*16 -->
<large-icon>/images/large.jpg</large-icon><!-- 32*32 -->
</icon>
<!-- display-name元素提供GUI工具可能會用來標記這個特定的Web應用的一個名稱 -->
<display-name>The applicaiton name</display-name>
<!-- description元素給出與此有關的說明性文字 -->
<description>A longer description of the application</description>
<!-- 用於告知Web容器: 應用設計為在分散式Web容器中執行. -->
<distributable />
<!-- context-param元素宣告應用範圍內的所有元件(servlet和JSP頁面)都可用的上下文引數 -->
<context-param>
<!-- 引數名稱 -->
<param-name>Support</param-name>
<!-- 引數值 -->
<param-value>xihaikun@eays.net</param-value>
</context-param>
<!-- 註冊一個過濾器元件 -->
<filter>
<!-- 描述 -->
<description></description>
<!-- 名稱 -->
<display-name></display-name>
<icon></icon>
<!-- 過濾器名稱 -->
<filter-name>filtername</filter-name>
<!-- 具體類 -->
<filter-class>com.ebuilds.Filter</filter-class>
<!-- 初始化引數 -->
<init-param>
<param-name></param-name>
<param-value></param-value>
</init-param>
</filter>
<!-- 將過濾器映像至一個URI模式, 或者映像至一個Servlet. -->
<filter-mapping>
<filter-name>filtername</filter-name>
<url-pattern></url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>filtername</filter-name>
<servlet-name>servletName</servlet-name>
</filter-mapping>
<!-- 註冊一個監聽器 -->
<listener>
<listener-class>com.ebuilds.ajax.TaskListener</listener-class>
</listener>
<!--
定義了Servlet或JSP頁面的細節. 最常見的情況是, 此元素僅把一個Servlet或JSP頁面與一個短名相關聯, 並指定初始化引數:
-->
<servlet>
<!-- servlet-name元素用來定義servlet的名稱,該名稱在整個應用中必須是惟一的 -->
<servlet-name>TimeServlet</servlet-name>
<!-- 用來指定servlet的完全限定的名稱 -->
<servlet-class>com.ebuilds.ajax.TimeServlet</servlet-class>
<!-- 元素用來指定應用中JSP檔案的完整路徑。這個完整路徑必須由/開始,不能和<servlet-class>元素同時出現 -->
<!-- <jsp-file>/index.jsp</jsp-file> -->
<init-param>
<param-name>count</param-name>
<param-value>1</param-value>
</init-param>
<!--
當啟動Web容器時,用load-on-startup元素自動將servlet加入記憶體。
載入servlet就意味著例項化這個servlet,並呼叫它的init方法。可以使用這個元素來避免第一個servlet請求的響應因為servlet載入記憶體所導致的任何延遲。
如果load-on-startup元素存在,而且也指定了jsp-file元素,則JSP檔案會被重新編譯成servlet,同時產生的servlet也被載入記憶體。
load-on-startup元素的內容可以為空,或者是一個整數。這個值表示由Web容器載入記憶體的順序。舉個例子,如果有兩個servlet元素都含有load-on-startup子元素,
則load-on-startup子元素值較小的servlet將先被載入。如果load-on-startup子元素值為空或負值,
則由Web容器決定什麼時候載入servlet。如果兩個servlet的load-on-startup子元素值相同,
則由Web容器決定先載入哪一個servlet
-->
<load-on-startup>1</load-on-startup>
<!--
如果定義了run-as元素,它會重寫用於呼叫Web應用中servlet所設定的Enterprise JavaBean(EJB)的安全身份。
-->
<run-as>
<!-- Role-name是為當前Web應用定義的一個安全形色的名稱 -->
<role-name></role-name>
</run-as>
<!--
security-role-ref元素定義一個對映,該對映在servlet中用isUserInRole (String
name)呼叫的角色名與為Web應用定義的安全形色名之間進行
-->
<security-role-ref>
<role-name></role-name>
<!--
role-link元素用來將安全形色引用連結到已定義的安全形色。role-link元素必須含有已經在security-role元素中定義的一個安全形色的名稱
-->
<role-link></role-link>
</security-role-ref>
</servlet>
<!-- 元素將一個Servlet或JSP頁面映像至一個URL模式. -->
<!-- 路徑字首模式: -->
<servlet-mapping>
<servlet-name>purchase</servlet-name>
<url-pattern>/po/*</url-pattern>
</servlet-mapping>
<!-- 完全匹模模工: -->
<servlet-mapping>
<servlet-name>sales-report</servlet-name>
<url-pattern>/report</url-pattern>
</servlet-mapping>
<!-- 副檔名映像模式: -->
<servlet-mapping>
<servlet-name>XMLProcessor</servlet-name>
<url-pattern>*.xml</url-pattern>
</servlet-mapping>
<!-- 定製會話處理屬性.在一個部署描述檔案中只能使用一個此類元素 -->
<session-config>
<!--設定會話過期時間以分鐘為單位 -->
<session-timeout>180</session-timeout>
</session-config>
<!-- 如果Web應用具有想到特殊的檔案,希望能保證給他們分配特定的MIME型別,則mime-mapping元素提供這種保證 -->
<mime-mapping>
<extension></extension>
<mime-type></mime-type>
</mime-mapping>
<!--定義要在目錄中查詢並提供索引檔案的有序表.如果使用了多個此類元素, 容器會將其合併. -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!--指定錯誤的頁面 -->
<error-page>
<!-- 指出在給定的HTTP錯誤程式碼出現時使用的URL -->
<error-code>404</error-code>
<location>/NotFound.jsp</location>
</error-page>
<error-page>
<!-- 指出在出現某個給定的Java異常但未捕捉到時使用的URL -->
<exception-type>exception.ServletNotFound</exception-type>
<location>/sorry.jsp</location>
</error-page>
<jsp-config>
<jsp-property-group>
<!-- 設定的說明 -->
<description>
Special property group for JSP Configuration JSP example.
</description>
<!-- 設定名稱 -->
<display-name>JSPConfiguration</display-name>
<!-- 設定值所影響的範圍 -->
<url-pattern>/jsp/*</url-pattern>
<!--允許或者禁止EL語言 若為true,表示不支援EL 語法 -->
<el-ignored>true</el-ignored>
<!-- 設定JSP 網頁的編碼 -->
<page-encoding>GB2312</page-encoding>
<!-- 若為true,表示不支援<% scripting %>語法 -->
<scripting-invalid>true</scripting-invalid>
<!-- 設定JSP 網頁的頭,副檔名為.jspf -->
<include-prelude>/include/prelude.jspf</include-prelude>
<!-- 設定JSP 網頁的結尾,副檔名為.jspf -->
<include-coda>/include/coda.jspf</include-coda>
</jsp-property-group>
<taglib>
<!--
指定自定義標籤在jsp頁面中引用時的uri
-->
<taglib-uri></taglib-uri>
<!--指定自定義標籤所在的實際物理位置-->
<taglib-location></taglib-location>
</taglib>
</jsp-config>
<!-- 宣告對於受保護資源使用何種鑑別方法.在一個部署描述檔案中只能使用一個此類元素 -->
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login/login.html</form-login-page>
<form-error-page>/login/error.html</form-error-page>
</form-login-config>
</login-config>
<!-- resource-env-ref元素宣告與資源相關的一個管理物件。 -->
<resource-env-ref>
<resource-env-ref-name>/jms/StockQueue</resource-env-ref-name>
<resource-env-ref-type>/javax.jms.Queue</resource-env-ref-type>
</resource-env-ref>
<!-- 為應用物件定義了JNDI可訪問物件工廠 -->
<resource-ref>
<res-ref-name>/jms/Production</res-ref-name>
<res-type>/javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<!-- 用於定義應用所用的角色名 -->
<security-role>
<role-name>admin</role-name>
</security-role>
<!-- 定義可由應用通過JNDI訪問的簡單物件, 如String 或 Boolean -->
<env-entry>
<env-entry-name>maxConnection</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>100</env-entry-value>
</env-entry>
<!-- 通常用於宣告應用所用的一個遠端EJB引用. -->
<ejb-ref>
<ejb-ref-name>ejb/Payroll</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.mycomp.PayrollHome</home>
<remote>com.mycomp.Payroll</remote>
</ejb-ref>
<!-- 宣告應用所用的一個本地EJB引用 -->
<ejb-local-ref>
<ejb-ref-name>ejb/Payroll</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.mycomp.PayrollHome</local-home>
<local>com.mycomp.Payroll</local>
</ejb-local-ref>
<!-- 宣告應用所用Web服務的一個引用 -->
<service-ref>
<service-ref-name></service-ref-name>
<service-interface></service-interface>
</service-ref>
<!-- 為應用所用的一個JMS訊息目標宣告一個邏輯名 -->
<message-destination>
<description>aaa</description>
<display-name>aaa</display-name>
<icon></icon>
<message-destination-name></message-destination-name>
</message-destination>
<!-- 宣告應用所用的JMS訊息和目標引用 -->
<message-destination-ref>
<!-- 在企業 Bean 程式碼中用作訊息目標(相對於 java:comp/env)的環境名稱 -->
<message-destination-ref-name>jms/StockQueue</message-destination-ref-name>
<!-- 被引用目標的預期型別 -->
<message-destination-type></message-destination-type>
<!-- 指定訊息是在目標使用的還是為目標生成的,或是用於這兩者 Produces/Consumes/ConsumesProduces -->
<message-destination-usage>Produces</message-destination-usage>
<!--
將訊息目標引用連結到實際訊息目標。此值必須與 weblogic-ejb-jar.xml 中的
message-destination-name 所定義的目標匹配
-->
<message-destination-link></message-destination-link>
</message-destination-ref>
<!-- 定義網站的字元編碼方式 -->
<locale-encoding-mapping-list>
<locale-encoding-mapping>
<locale>zh</locale>
<encoding>gb2312</encoding>
</locale-encoding-mapping>
</locale-encoding-mapping-list>
</web-app>
相關文章
- Nginx的配置檔案說明Nginx
- nginx日誌配置檔案說明Nginx
- springMVC---配置檔案解析(web.xml)SpringMVCWebXML
- CentOS8中systemd配置檔案說明CentOS
- Centos系統中 Systemd 的Unit檔案配置說明CentOS
- Centos7 中 Systemd 的Unit檔案配置說明CentOS
- 在.NET CORE中使用配置檔案:對 ConfigurationBuilder 的使用說明UI
- fepk檔案格式說明
- 在web.xml檔案中配置Servlet時,主要配置哪些資訊?WebXMLServlet
- Linux下玩轉nginx系列(二)——nginx配置檔案說明LinuxNginx
- 簡單說說webpack的配置檔案Web
- django的初始化檔案說明Django
- Linux下玩轉nginx系列(三)---nginx日誌配置檔案說明LinuxNginx
- Oracle安裝光碟內容的檔案說明Oracle
- rust配置說明Rust
- 『忘了再學』Shell基礎 — 22、主要的環境變數配置檔案說明變數
- Hadoop之HDFS檔案讀寫流程說明Hadoop
- C++檔案說明及使用方法C++
- JVM(筆記)—— Class 類檔案結構的說明(二)JVM筆記
- Linux中log檔案是什麼意思?Linux日誌檔案說明Linux
- 易優CMS模板目錄各檔案說明
- Nginx的gzip配置引數說明Nginx
- Revit Server的注意要配置說明Server
- elasticsearch.yml 配置說明Elasticsearch
- kettle MongoDB Output 配置說明MongoDB
- 雷池 docker env 配置說明Docker
- 自研 PHP 框架 1.1_index.php 檔案說明PHP框架Index
- 自研 PHP 框架 1.0_index.php 檔案說明PHP框架Index
- maven工作目錄、編譯後的目錄說明及mybatis-plus的xml檔案路徑配置Maven編譯MyBatisXML
- ADS-B接入配置說明
- keycloak~token配置相關說明
- MobTech ShareSDK 後臺配置說明
- Rockchip RK3399 SDMMC 的 DTS 配置說明
- Rockchip RK3399 SDIO 的 DTS 配置說明
- Rockchip RK3399 eMMc 的 DTS 配置說明
- nginx 詳解 - 詳細配置說明Nginx
- VNC安裝配置詳細說明VNC
- nginx 詳解 – 詳細配置說明Nginx
- 【NETWORK】Oracle RAC 心跳地址配置說明Oracle