1. 程式人生 > >Java學習02-web.xml配置詳解

Java學習02-web.xml配置詳解

log 用戶授權 相對 lte 聯合 page int config 定制

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://java.sun.com/xml/ns/javaee"
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
         id="WebApp_ID" version="3.0">
         
    <!--
icon元素指出IDE和GUI工具用來表示Web應用的一個和兩個圖像文件的位置。 --> <icon></icon> <!-- display-name元素提供GUI工具可能會用來標記這個特定的Web應用的一個名稱。 --> <display-name></display-name> <!-- description元素給出與此有關的說明性文本。 --> <description></description> <!--
context-param元素聲明應用範圍內的初始化參數 --> <context-param></context-param> <!-- filter 過濾器元素將一個名字與一個實現javax.servlet.Filter接口的類相關聯。 --> <filter></filter> <!-- filter-mapping 一旦命名了一個過濾器,就要利用filter-mapping元素把它與一個或多個servlet或JSP頁面相關聯。 --> <filter-mapping
></filter-mapping> <!-- listener 對事件監聽程序的支持,事件監聽程序在建立、修改和刪除會話或servlet環境時得到通知。Listener元素指出事件監聽程序類。 --> <listener></listener> <!-- servlet 在向servlet或JSP頁面制定初始化參數或定制URL時,必須首先命名servlet或JSP頁面。Servlet元素就是用來完成此項任務的。 --> <servlet></servlet> <!-- servlet-mapping 服務器一般為servlet提供一個缺省的URL:http://host/webAppPrefix/servlet/ServletName。但是,常常會更改這個URL,以便servlet可以訪問初始化參數或更容易地處理相對URL。在更改缺省URL時,使用servlet-mapping元素。 --> <servlet-mapping></servlet-mapping> <!-- session-config 如果某個會話在一定時間內未被訪問,服務器可以拋棄它以節省內存。可通過使用HttpSession的setMaxInactiveInterval方法明確設置單個會話對象的超時值,或者可利用session-config元素制定缺省超時值。 --> <session-config></session-config> <!-- mime-mapping 如果Web應用具有想到特殊的文件,希望能保證給他們分配特定的MIME類型,則mime-mapping元素提供這種保證。 --> <mime-mapping></mime-mapping> <!-- welcome-file-list元素指示服務器在收到引用一個目錄名而不是文件名的URL時,使用哪個文件。 --> <welcome-file-list></welcome-file-list> <!-- error-page元素使得在返回特定HTTP狀態代碼時,或者特定類型的異常被拋出時,能夠制定將要顯示的頁面。 --> <error-page></error-page> <!-- resource-env-ref元素聲明與資源相關的一個管理對象。 --> <resource-env-ref></resource-env-ref> <!-- resource-ref元素聲明一個資源工廠使用的外部資源。 --> <resource-ref></resource-ref> <!-- security-constraint元素制定應該保護的URL。它與login-config元素聯合使用 --> <security-constraint></security-constraint> <!-- 用login-config元素來指定服務器應該怎樣給試圖訪問受保護頁面的用戶授權。它與sercurity-constraint元素聯合使用。 --> <login-config></login-config> <!-- security-role元素給出安全角色的一個列表,這些角色將出現在servlet元素內的security-role-ref元素的role-name子元素中。分別地聲明角色可使高級IDE處理安全信息更為容易。 --> <security-role></security-role> <!-- env-entry元素聲明Web應用的環境項。 --> <env-entry></env-entry> <!-- ejb-ref元素聲明一個EJB的主目錄的引用。 --> <ejb-ref></ejb-ref> <!-- ejb-local-ref元素聲明一個EJB的本地主目錄的應用。 --> <ejb-local-ref></ejb-local-ref> </web-app>

註:摘取於http://www.cnblogs.com/ClassNotFoundException/p/6641867.html

Java學習02-web.xml配置詳解