国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

web.xml 中的listener、 filter、servlet 加載順序及其詳解

2019-11-11 05:13:00
字體:
來源:轉載
供稿:網友

原文:http://www.cnblogs.com/JesseV/archive/2009/11/17/1605015.html

在項目中總會遇到一些關于加載的優先級問題,近期也同樣遇到過類似的,所以自己查找資料總結了下,下面有些是</welcome-file>          <welcome-file>index.htm</welcome-file>       </welcome-file-list>    11、配置錯誤頁面        一、 通過錯誤碼來配置error-page       <error-page>          <error-code>404</error-code>          <location>/NotFound.jsp</location>       </error-page>        上面配置了當系統發生404錯誤時,跳轉到錯誤處理頁面NotFound.jsp。            二、通過異常的類型配置error-page        <error-page>           <exception-type>java.lang.NullException</exception-type>           <location>/error.jsp</location>        </error-page>        上面配置了當系統發生java.lang.NullException(即空指針異常)時,跳轉到錯誤處理頁面error.jsp    12、TLD配置       <taglib>           <taglib-uri>http://jakarta.apache.org/tomcat/debug-taglib</taglib-uri>           <taglib-location>/WEB-INF/jsp/debug-taglib.tld</taglib-location>       </taglib>       如果MyEclipse一直在報錯,應該把<taglib> 放到 <jsp-config>中       <jsp-config>          <taglib>              <taglib-uri>http://jakarta.apache.org/tomcat/debug-taglib</taglib-uri>              <taglib-location>/WEB-INF/pager-taglib.tld</taglib-location>          </taglib>       </jsp-config>    13、資源管理對象配置       <resource-env-ref>           <resource-env-ref-name>jms/StockQueue</resource-env-ref-name>       </resource-env-ref>    14、資源工廠配置       <resource-ref>           <res-ref-name>mail/session</res-ref-name>           <res-type>javax.mail.Session</res-type>           <res-auth>Container</res-auth>       </resource-ref>       配置數據庫連接池就可在此配置:       <resource-ref>           <description>JNDI JDBC DataSource of shop</description>           <res-ref-name>jdbc/sample_db</res-ref-name>           <res-type>javax.sql.DataSource</res-type>           <res-auth>Container</res-auth>       </resource-ref>    15、安全限制配置       <security-constraint>          <display-name>Example Security Constraint</display-name>          <web-resource-collection>             <web-resource-name>PRotected Area</web-resource-name>             <url-pattern>/jsp/security/protected/*</url-pattern>             <http-method>DELETE</http-method>             <http-method>GET</http-method>             <http-method>POST</http-method>             <http-method>PUT</http-method>          </web-resource-collection>          <auth-constraint>            <role-name>tomcat</role-name>            <role-name>role1</role-name>          </auth-constraint>       </security-constraint>    16、登陸驗證配置       <login-config>         <auth-method>FORM</auth-method>         <realm-name>Example-Based Authentiation Area</realm-name>         <form-login-config>            <form-login-page>/jsp/security/protected/login.jsp</form-login-page>            <form-error-page>/jsp/security/protected/error.jsp</form-error-page>         </form-login-config>       </login-config>    17、安全角色:security-role元素給出安全角色的一個列表,這些角色將出現在servlet元素內的security-role-ref元素的role-name子元素中。        分別地聲明角色可使高級IDE處理安全信息更為容易。    <security-role>         <role-name>tomcat</role-name>    </security-role>    18、Web環境參數:env-entry元素聲明Web應用的環境項    <env-entry>         <env-entry-name>minExemptions</env-entry-name>         <env-entry-value>1</env-entry-value>         <env-entry-type>java.lang.Integer</env-entry-type>    </env-entry>    19、EJB 聲明    <ejb-ref>         <description>Example EJB reference</decription>         <ejb-ref-name>ejb/Account</ejb-ref-name>         <ejb-ref-type>Entity</ejb-ref-type>         <home>com.mycompany.mypackage.AccountHome</home>         <remote>com.mycompany.mypackage.Account</remote>    </ejb-ref>    20、本地EJB聲明    <ejb-local-ref>         <description>Example Loacal EJB reference</decription>         <ejb-ref-name>ejb/ProcessOrder</ejb-ref-name>         <ejb-ref-type>Session</ejb-ref-type>         <local-home>com.mycompany.mypackage.ProcessOrderHome</local-home>         <local>com.mycompany.mypackage.ProcessOrder</local>    </ejb-local-ref>    21、配置DWR    <servlet>          <servlet-name>dwr-invoker</servlet-name>          <servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>    </servlet>    <servlet-mapping>          <servlet-name>dwr-invoker</servlet-name>          <url-pattern>/dwr/*</url-pattern>    </servlet-mapping>    22、配置Struts        <display-name>Struts Blank application</display-name>        <servlet>            <servlet-name>action</servlet-name>            <servlet-class>                org.apache.struts.action.ActionServlet            </servlet-class>            <init-param>                <param-name>detail</param-name>                <param-value>2</param-value>            </init-param>            <init-param>                <param-name>debug</param-name>                <param-value>2</param-value>            </init-param>            <init-param>                <param-name>config</param-name>                <param-value>/WEB-INF/struts-config.xml</param-value>            </init-param>            <init-param>                <param-name>application</param-name>                <param-value>ApplicationResources</param-value>            </init-param>            <load-on-startup>2</load-on-startup>        </servlet>        <servlet-mapping>            <servlet-name>action</servlet-name>            <url-pattern>*.do</url-pattern>        </servlet-mapping>        <welcome-file-list>            <welcome-file>index.jsp</welcome-file>        </welcome-file-list>        <!-- Struts Tag Library Descriptors -->        <taglib>            <taglib-uri>struts-bean</taglib-uri>            <taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>        </taglib>        <taglib>            <taglib-uri>struts-html</taglib-uri>            <taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>        </taglib>        <taglib>        <taglib-uri>struts-nested</taglib-uri>        <taglib-location>/WEB-INF/tld/struts-nested.tld</taglib-location>        </taglib>        <taglib>            <taglib-uri>struts-logic</taglib-uri>            <taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>        </taglib>        <taglib>            <taglib-uri>struts-tiles</taglib-uri>            <taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>        </taglib>    23、配置Spring(基本上都是在Struts中配置的)       <!-- 指定spring配置文件位置 -->       <context-param>          <param-name>contextConfigLocation</param-name>          <param-value>           <!--加載多個spring配置文件 -->            /WEB-INF/applicationContext.xml, /WEB-INF/action-servlet.xml          </param-value>       </context-param>       <!-- 定義SPRING監聽器,加載spring -->    <listener>         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>    </listener>    <listener>         <listener-class>           org.springframework.web.context.request.RequestContextListener         </listener-class>    </listener>  

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 大埔县| 临江市| 奉贤区| 綦江县| 曲阜市| 万盛区| 阿城市| 沙洋县| 河南省| 秭归县| 安多县| 仁布县| 大邑县| 莱西市| 兴海县| 樟树市| 平阳县| 莱阳市| 措勤县| 安龙县| 定结县| 左贡县| 抚宁县| 尉氏县| 内乡县| 黄冈市| 丹东市| 建宁县| 深圳市| 晋江市| 达日县| 建宁县| 宝兴县| 天门市| 定陶县| 西昌市| 同心县| 精河县| 宁都县| 海城市| 江都市|