<?
xmlversion="1.0"encoding="ISO-8859-1"
?>
<! DOCTYPEweb-appPUBLIC"-//SunMicrosystems,Inc.//DTDWebApplication2.3//EN""http://java.sun.com/j2ee/dtds/web-app_2_3.dtd" >
< 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/j2eeweb-app_2_4.xsd" version ="2.4" >
< display-name > TestWebapp </ display-name > <!-- 站点名称 -->
< description > <!-- 站点描述 -->
Thisisasampledeploymentdescriptorthatshowstheuseofimportantelements.
</ description >
< icon >
< small-icon > /images/small.gif </ small-icon > <!-- 小图标的路径16*16,必须为gifjpg格式 -->
< large-icon > /images/large.gif </ large-icon > <!-- 大图标的路径32*32,必须为gifjpg格式 -->
</ icon >
<!-- 该标志表示应用程序能够在多系统之间运行,在有多个servlet下才需要! -->
< distributable />
<!-- 通常context-param指定数据库驱动、协议设置和URL路径信息。是application级的变量.只能跟在web-app之后。
取得常量this.getInitParameter("context"); -->
< context-param >
< param-name > locale </ param-name >
< param-value > US </ param-value >
</ context-param >
< context-param >
< param-name > DBName </ param-name >
< param-value > Oracle </ param-value >
</ context-param >
<!-- filter和filter-mapping标志必须在任何servlet标志之前定义。listener也是 -->
< filter >
< filter-name > TestFilter </ filter-name >
< description > Justfortest </ description >
< filter-class > filters.TestFilter </ filter-class >
< init-param >
< param-name > locale </ param-name >
< param-value > US </ param-value >
</ init-param >
</ filter >
< filter-mapping >
< filter-name > TestFilter </ filter-name >
< url-pattern > /*.jsp </ url-pattern > <!-- 如果在servlet上使用该过滤器:<servlet-name>myServlet</servlet-name> -->
< dispatcher > FORWARD </ dispatcher > <!-- 指定请求转送方式,可设定为request,include,forward,error四种 -->
</ filter-mapping >
<!-- Definesapplicationeventslisteners -->
< listener >
< listener-class > listeners.MyServletContextListener </ listener-class >
</ listener >
< listener >
< listener-class > listeners.MySessionCumContextListener </ listener-class >
</ listener >
<!-- Definesservlets -->
< servlet >
< servlet-name > TestServlet </ servlet-name >
< description > Justfortest </ description >
< servlet-class > servlets.TestServlet </ servlet-class >
<!-- 因为JSP页面要转换成sevlet,自然希望就像命名servlet一样命名JSP页面。为了命名JSP页面,可将servlet-class元素替换为jsp-file元素 -->
</ servlet >
< servlet >
< servlet-name > HelloServlet </ servlet-name >
< servlet-class > servlets.HelloServlet </ servlet-class >
< init-param > <!-- 该标志定义外层servlet可以访问的变量的名称、值和描述 -->
< param-name > locale </ param-name >
< param-value > US </ param-value >
</ init-param >
< load-on-startup > 1 </ load-on-startup > <!-- 在servlet的配置当中,该标记指示容器是否在启动的时候就加载这个servlet,当值为0或者大于0时,表示容器在应用启动时就加载这个servlet当是一个负数时或者没有指定时,则指示容器在该servlet被选择时才加载,正数的值越小,启动该servlet的优先级越高。 -->
< security-role-ref > <!-- 元素提供出现在服务器专用口令文件中的安全角色名的一个别名 -->
<!-- role-nameisusedinHttpServletRequest.isUserInRole(Stringrole)method. -->
< role-name > manager </ role-name >
<!-- role-linkisoneoftherole-namesspecifiedinsecurity-roleelements. -->
< role-link > supervisor </ role-link >
< security-role-ref >
</ servlet >
<!-- Definesservletmappings -->
< servlet-mapping >
< servlet-name > TestServlet </ servlet-name >
< url-pattern > /test/* </ url-pattern > <!-- uil-pattern标志确定上下文之后的标志 -->
</ servlet-mapping >
< servlet-mapping >
< servlet-name > HelloServlet </ servlet-name >
< url-pattern > *.hello </ url-pattern >
</ servlet-mapping >
< session-config >
<!-- specifiessessiontimeoutas30minutes. -->
< session-timeout > 30 </ session-timeout >
</ session-config >
< mime-mapping >
< extension > jar </ extension >
< mime-type > application/java-archive </ mime-type >
</ mime-mapping >
< mime-mapping > <!-- 这个例子展示了自动将application/pdfMIME类型与所有扩展名为*.pdf的文件关联起来 -->
< extension > pdf </ extension >
< mime-type > application/pdf </ mime-type >
</ mime-mapping >
< welcome-file-list >
< welcome-file > index.html </ welcome-file >
< welcome-file > home.html </ welcome-file >
< welcome-file > welcome.html </ welcome-file >
</ welcome-file-list >
< error-page >
< error-code > 404 </ error-code >
< location > notfoundpage.jsp </ location >
</ error-page >
< error-page >
< exception-type > java.sql.SQLException </ exception-type >
< location > sqlexception.jsp </ location >
</ error-page >
< taglib >
< taglib-uri > /examplelib </ taglib-uri >
< taglib-location > /WEB-INF/tlds/examplelib.tld </ taglib-location >
</ taglib >
< taglib >
< taglib-uri > http://abc.com/testlib </ taglib-uri >
< taglib-location > /WEB-INF/tlds/testlib.jar </ taglib-location > <!-- 可以是jar包 -->
</ taglib >
< taglib id ="ABC_MATH_LIB" > <!-- 可以有并只能有一个id作为属性 -->
< taglib-uri > /binomial </ taglib-uri >
< taglib-location > /WEB-INF/MathLib.tld </ taglib-location >
</ taglib >
< security-constraint >
< display-name > ExampleSecurityConstraint </ display-name >
< web-resource-collection >
< web-resource-name > ProtectedArea </ web-resource-name >
< url-pattern > /test/* </ url-pattern >
<!-- Whenthereisno<http-method>elementin<security-constraint>,allmethodsareprotected. -->
< http-method > POST </ http-method >
</ web-resource-collection >
< web-resource-collection >
< web-resource-name > AnotherProtectedArea </ web-resource-name >
< url-pattern > *.hello </ url-pattern >
<!-- Allmethodsareprotectedasnohttp-methodisspecified -->
</ web-resource-collection >
< auth-constraint >
<!-- 设定允许存取的角色名称,必须符合<security-role>元素设定 -->
< role-name > supervisor </ role-name >
</ auth-constraint >
<!-- 这个可选的元素指出在访问相关资源时使用任何传输层保护 -->
< user-data-constraint >
<!-- transport-guarantee为NONE值将对所用的通讯协议不加限制。INTEGRAL值表示数据必须以一种防止截取它的人阅读它的方式传送。虽然原理上INTEGRAL和CONFIDENTIAL之间可能会有差别,但在当前实践中,他们都只是简单地要求用SSL -->
< transport-guarantee > INTEGRAL </ transport-guarantee >
</ user-data-constraint >
</ security-constraint >
< login-config >
<!-- auth-methodcanbe:BASIC,FORM,DIGEST,orCLIENT-CERT -->
< auth-method > FORM </ auth-method >
< realm-name > sales </ realm-name > <!-- 该标志是验证用来确定某个特定的站点区域 -->
< form-login-config >
< form-login-page > /formlogin.html </ form-login-page >
< form-error-page > /formerror.jsp </ form-error-page >
</ form-login-config >
</ login-config >
<!-- Specifiestherolesthataredefinedintheapplicationserver.Forexample,Tomcatdefinesitinconf omcat-users.xml -->
< security-role >
< role-name > supervisor </ role-name >
</ security-role >
< security-role >
< role-name > worker </ role-name >
</ security-role >
<!-- *****************************以下是J2EE元素的内容***************************** -->
< resource-env-ref > <!-- 声明一个与某个资源有关的管理对象 -->
< resource-env-ref-name > jms/StockQueue </ resource-env-ref-name > <!-- 一个相对于java:comp/env环境的JNDI名 -->
< resource-env-ref-type > javax.jms.Queue </ resource-env-ref-type > <!-- 指定资源类型的完全限定的类 -->
</ resource-env-ref >
< env-entry > <!-- 声明Web应用的环境项 -->
< env-entry-name > minAmout </ env-entry-name > <!-- 一个相对于java:comp/env环境JNDI名 -->
< env-entry-value > 100.00 </ env-entry-value > <!-- 项值 -->
< env-entry-type > minAmout </ env-entry-type > <!-- java.lang程序包中一个类型的完全限定类名,Boolean、String等 -->
</ env-entry >
<!-- *****************************以下是JSP2.0新增加的内容***************************** -->
<!-- Servle
<! DOCTYPEweb-appPUBLIC"-//SunMicrosystems,Inc.//DTDWebApplication2.3//EN""http://java.sun.com/j2ee/dtds/web-app_2_3.dtd" >
< 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/j2eeweb-app_2_4.xsd" version ="2.4" >
< display-name > TestWebapp </ display-name > <!-- 站点名称 -->
< description > <!-- 站点描述 -->
Thisisasampledeploymentdescriptorthatshowstheuseofimportantelements.
</ description >
< icon >
< small-icon > /images/small.gif </ small-icon > <!-- 小图标的路径16*16,必须为gifjpg格式 -->
< large-icon > /images/large.gif </ large-icon > <!-- 大图标的路径32*32,必须为gifjpg格式 -->
</ icon >
<!-- 该标志表示应用程序能够在多系统之间运行,在有多个servlet下才需要! -->
< distributable />
<!-- 通常context-param指定数据库驱动、协议设置和URL路径信息。是application级的变量.只能跟在web-app之后。
取得常量this.getInitParameter("context"); -->
< context-param >
< param-name > locale </ param-name >
< param-value > US </ param-value >
</ context-param >
< context-param >
< param-name > DBName </ param-name >
< param-value > Oracle </ param-value >
</ context-param >
<!-- filter和filter-mapping标志必须在任何servlet标志之前定义。listener也是 -->
< filter >
< filter-name > TestFilter </ filter-name >
< description > Justfortest </ description >
< filter-class > filters.TestFilter </ filter-class >
< init-param >
< param-name > locale </ param-name >
< param-value > US </ param-value >
</ init-param >
</ filter >
< filter-mapping >
< filter-name > TestFilter </ filter-name >
< url-pattern > /*.jsp </ url-pattern > <!-- 如果在servlet上使用该过滤器:<servlet-name>myServlet</servlet-name> -->
< dispatcher > FORWARD </ dispatcher > <!-- 指定请求转送方式,可设定为request,include,forward,error四种 -->
</ filter-mapping >
<!-- Definesapplicationeventslisteners -->
< listener >
< listener-class > listeners.MyServletContextListener </ listener-class >
</ listener >
< listener >
< listener-class > listeners.MySessionCumContextListener </ listener-class >
</ listener >
<!-- Definesservlets -->
< servlet >
< servlet-name > TestServlet </ servlet-name >
< description > Justfortest </ description >
< servlet-class > servlets.TestServlet </ servlet-class >
<!-- 因为JSP页面要转换成sevlet,自然希望就像命名servlet一样命名JSP页面。为了命名JSP页面,可将servlet-class元素替换为jsp-file元素 -->
</ servlet >
< servlet >
< servlet-name > HelloServlet </ servlet-name >
< servlet-class > servlets.HelloServlet </ servlet-class >
< init-param > <!-- 该标志定义外层servlet可以访问的变量的名称、值和描述 -->
< param-name > locale </ param-name >
< param-value > US </ param-value >
</ init-param >
< load-on-startup > 1 </ load-on-startup > <!-- 在servlet的配置当中,该标记指示容器是否在启动的时候就加载这个servlet,当值为0或者大于0时,表示容器在应用启动时就加载这个servlet当是一个负数时或者没有指定时,则指示容器在该servlet被选择时才加载,正数的值越小,启动该servlet的优先级越高。 -->
< security-role-ref > <!-- 元素提供出现在服务器专用口令文件中的安全角色名的一个别名 -->
<!-- role-nameisusedinHttpServletRequest.isUserInRole(Stringrole)method. -->
< role-name > manager </ role-name >
<!-- role-linkisoneoftherole-namesspecifiedinsecurity-roleelements. -->
< role-link > supervisor </ role-link >
< security-role-ref >
</ servlet >
<!-- Definesservletmappings -->
< servlet-mapping >
< servlet-name > TestServlet </ servlet-name >
< url-pattern > /test/* </ url-pattern > <!-- uil-pattern标志确定上下文之后的标志 -->
</ servlet-mapping >
< servlet-mapping >
< servlet-name > HelloServlet </ servlet-name >
< url-pattern > *.hello </ url-pattern >
</ servlet-mapping >
< session-config >
<!-- specifiessessiontimeoutas30minutes. -->
< session-timeout > 30 </ session-timeout >
</ session-config >
< mime-mapping >
< extension > jar </ extension >
< mime-type > application/java-archive </ mime-type >
</ mime-mapping >
< mime-mapping > <!-- 这个例子展示了自动将application/pdfMIME类型与所有扩展名为*.pdf的文件关联起来 -->
< extension > pdf </ extension >
< mime-type > application/pdf </ mime-type >
</ mime-mapping >
< welcome-file-list >
< welcome-file > index.html </ welcome-file >
< welcome-file > home.html </ welcome-file >
< welcome-file > welcome.html </ welcome-file >
</ welcome-file-list >
< error-page >
< error-code > 404 </ error-code >
< location > notfoundpage.jsp </ location >
</ error-page >
< error-page >
< exception-type > java.sql.SQLException </ exception-type >
< location > sqlexception.jsp </ location >
</ error-page >
< taglib >
< taglib-uri > /examplelib </ taglib-uri >
< taglib-location > /WEB-INF/tlds/examplelib.tld </ taglib-location >
</ taglib >
< taglib >
< taglib-uri > http://abc.com/testlib </ taglib-uri >
< taglib-location > /WEB-INF/tlds/testlib.jar </ taglib-location > <!-- 可以是jar包 -->
</ taglib >
< taglib id ="ABC_MATH_LIB" > <!-- 可以有并只能有一个id作为属性 -->
< taglib-uri > /binomial </ taglib-uri >
< taglib-location > /WEB-INF/MathLib.tld </ taglib-location >
</ taglib >
< security-constraint >
< display-name > ExampleSecurityConstraint </ display-name >
< web-resource-collection >
< web-resource-name > ProtectedArea </ web-resource-name >
< url-pattern > /test/* </ url-pattern >
<!-- Whenthereisno<http-method>elementin<security-constraint>,allmethodsareprotected. -->
< http-method > POST </ http-method >
</ web-resource-collection >
< web-resource-collection >
< web-resource-name > AnotherProtectedArea </ web-resource-name >
< url-pattern > *.hello </ url-pattern >
<!-- Allmethodsareprotectedasnohttp-methodisspecified -->
</ web-resource-collection >
< auth-constraint >
<!-- 设定允许存取的角色名称,必须符合<security-role>元素设定 -->
< role-name > supervisor </ role-name >
</ auth-constraint >
<!-- 这个可选的元素指出在访问相关资源时使用任何传输层保护 -->
< user-data-constraint >
<!-- transport-guarantee为NONE值将对所用的通讯协议不加限制。INTEGRAL值表示数据必须以一种防止截取它的人阅读它的方式传送。虽然原理上INTEGRAL和CONFIDENTIAL之间可能会有差别,但在当前实践中,他们都只是简单地要求用SSL -->
< transport-guarantee > INTEGRAL </ transport-guarantee >
</ user-data-constraint >
</ security-constraint >
< login-config >
<!-- auth-methodcanbe:BASIC,FORM,DIGEST,orCLIENT-CERT -->
< auth-method > FORM </ auth-method >
< realm-name > sales </ realm-name > <!-- 该标志是验证用来确定某个特定的站点区域 -->
< form-login-config >
< form-login-page > /formlogin.html </ form-login-page >
< form-error-page > /formerror.jsp </ form-error-page >
</ form-login-config >
</ login-config >
<!-- Specifiestherolesthataredefinedintheapplicationserver.Forexample,Tomcatdefinesitinconf omcat-users.xml -->
< security-role >
< role-name > supervisor </ role-name >
</ security-role >
< security-role >
< role-name > worker </ role-name >
</ security-role >
<!-- *****************************以下是J2EE元素的内容***************************** -->
< resource-env-ref > <!-- 声明一个与某个资源有关的管理对象 -->
< resource-env-ref-name > jms/StockQueue </ resource-env-ref-name > <!-- 一个相对于java:comp/env环境的JNDI名 -->
< resource-env-ref-type > javax.jms.Queue </ resource-env-ref-type > <!-- 指定资源类型的完全限定的类 -->
</ resource-env-ref >
< env-entry > <!-- 声明Web应用的环境项 -->
< env-entry-name > minAmout </ env-entry-name > <!-- 一个相对于java:comp/env环境JNDI名 -->
< env-entry-value > 100.00 </ env-entry-value > <!-- 项值 -->
< env-entry-type > minAmout </ env-entry-type > <!-- java.lang程序包中一个类型的完全限定类名,Boolean、String等 -->
</ env-entry >
<!-- *****************************以下是JSP2.0新增加的内容***************************** -->
<!-- Servle
发表评论
评论