æ¬æ使ç¨çæå¡å¨æ¯Tomcatæå¡å¨ï¼Webåºç¨åå¸æè¿°æ件web.xmlæ¯å¨Servletè§èä¸å®ä¹çãweb.xmlåæ¾å¨WEB-INF/ç®å½ä¸
å¨åæweb.xmlææ¡£ä¹åææ³å
说ä¸ä¸web.xmlä¸æ ¹å
ç´ <web-app>ååå
ç´ ç顺åºé®é¢ï¼å 为å¨web.xmlä¸å
ç´ å®ä¹çå
å顺åºæ¯ä¸è½é¢ åçï¼é¤éå¨web.xmlæ件ä¸ä½¿ç¨XML Schemaï¼æ¬æä¸å讨论ï¼ï¼å¦åTomcatæå¡å¨å¯è½æåºSAXParseExceptionã
顺åºå¦ä¸ï¼
<web-app>
<display-name>
<description>
<distributable>
<context-param>
<filter>
<filter-mapping>
<listener>
<servlet>
<servlet-mapping>
<session-config>
<mime-mapping>
<welcome-file-list>
<error-page>
<taglib>
<resource-env-ref>
<resource-ref>
<security-constraint>
<login-config>
<security-role>
<env-entry>
<ejb-ref>
<ejb-local-ref>
web.xmlä¸çå¼å¤´å è¡æ¯åºå®çï¼å®å®ä¹äºè¯¥æ件çå符ç¼ç ï¼XMLçæ¬ä»¥åå¼ç¨çDTDæ件ã
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "
http://java.sun.com/dtd/web-app_2_3.dtd">
å¨web.xmlä¸é¡¶å±å
ç´ ä¸º<web-app>ï¼å
¶ä»ææçåå
ç´ é½å¿
é¡»å®ä¹å¨<web-app>å
<display-name>å
ç´ å®ä¹è¿ä¸ªwebåºç¨çååï¼Java Web æå¡å¨çWeb管çå·¥å
·å°ç¨è¿ä¸ªååæ¥æ å¿Webåºç¨ã
<description>å
ç´ ç¨æ¥å£°æWebåºç¨çæè¿°ä¿¡æ¯
<context-param>å
ç´ ç¨æ¥é
ç½®å¤é¨å¼ç¨çï¼å¨servletä¸å¦æè¦è·å¾è¯¥å
ç´ ä¸é
ç½®çå¼ï¼String param-value = getServletContext().getInitParameter("param-name")
<filter>
<filter-name>SampleFilter</filter-name>
<filter-class>com.lpdev.SampleFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>SampleFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
以ä¸æ¯é
ç½®äºä¸ä¸ªservletè¿æ»¤å¨ï¼å¯¹äºservlet容å¨æ¶å°ç客æ·è¯·æ±ä»¥åååºçååºç»æï¼servleté½è½æ£æ¥åä¿®æ¹å
¶ä¸çä¿¡æ¯ï¼ä»¥ä¸ä»£ç æåå½å®¢æ·è¯·æ±è®¿é®Webåºç¨ä¸çææJSPæ件æ¶ï¼å°è§¦åSampleFilterè¿æ»¤å¨å·¥ä½ï¼å
·ä½çè¿æ»¤äºå¡å¨ç±<filter-class>ä¸æå®çç±»æ¥å®æ
<servlet>
<servlet-name>IncludeServlet</servlet-name>
<servlet-class>com.lpdev.IncludeServlet</servlet-class>
<init-param>
<param-name>copyright</param-name>
<param-value>/foot.jspf</param-value>
<load-on-startup>1</load-on-startup>
</init-param>
</servlet>
é
ç½®Servletï¼<servlet-name>æ¯servletçååï¼<servlet-class>æ¯å®ç°è¿ä¸ªServletçç±»ï¼<init-param>å®ä¹Servletçåå§ååæ°ï¼åæ°åååæ°å¼ï¼ï¼ä¸ä¸ªServletå¯ä»¥æå¤ä¸ª<init-param>ï¼å¨Servletç±»ä¸éè¿getInitParameter(String name)æ¹æ³è®¿é®åå§ååæ°
<servlet-mapping>
<servlet-name>IncludeServlet</servlet-name>
<url-pattern>/IncludeServlet</url-pattern>
</servlet-mapping>
é
ç½®Servletæ å°ï¼<servlet-mapping>å
ç´ ç¨æ¥è®¾å®å®¢æ·è®¿é®æ个ServletçURLï¼è¿éåªéç»åºå¯¹äºæ´ä¸ªwebåºç¨çç¸å¯¹çURLè·¯å¾ï¼<url-pattern>ä¸ç“/”表示å¼å§äºWebåºç¨çæ ¹ç®å½ä¾å¦ï¼å¦æä½ å¨ä½ æ¬å°æºå¨ä¸ä½¿ç¨Tomcat4.1.xï¼å¹¶ä¸å建äºå为“myapp”çåºç¨ç¨åºï¼<url-pattern>/IncludeServlet</url-pattern>该Servletçå®æ´webå°åå°±æ¯http://localhost:8080/myapp/IncludeServlet
<session-config>å
ç´ ç¨æ¥è®¾å®HttpSessionççå½å¨æï¼è¯¥å
ç´ åªæä¸ä¸ª<session-timeout>å±æ§ï¼æ¶é´åä½æ¯“秔ã
<welcome-file-list>å½ç¨æ·è®¿é®webæ¶ï¼å¦æä»
ä»
ç»åºwebåºç¨çRoot URLï¼æ²¡ææå®å
·ä½æ件åï¼å®¹å¨è°ç¨è¯¥é
ç½®ï¼è¯¥å
ç´ å¯ä»¥å
å«å¤ä¸ª<welcome-file>å±æ§ã
<taglib>å
ç´ ç¨æ¥è®¾ç½®webå¼ç¨çtag library,ä¾ç¤ºå®ä¹äºä¸ä¸ª“/mytaglib”æ ç¾åºï¼å®å¯¹åºçtldæ件为ï¼/WEB_INF/mytaglib.tld
<taglib>
<taglib-url>/mytaglib</taglib-url>
<taglib-locationg>/WEB-INF/mytaglib.tld</taglib-location>
</taglib>
<resource-ref>å¦æwebåºç¨ç±Servlet容å¨ç®¡ççæ个JNDI Resourceï¼å¿
é¡»å¨web.xmlä¸å£°æ对è¿ä¸ªJNDI Resourceçå¼ç¨ã
<resource-ref>
<description>DB Connection</description> //说æ
<res-ref-name>jdbc/sampleDB</res-ref-name> //å¼ç¨èµæºçJNDIåå
<res-type>javax.sql.DataSource</res-type> //å¼ç¨èµæºçç±»åå
<res-auth>Container</res-auth> //管çå¼ç¨èµæºçManager
</resource-ref>
<security-constraint>ç¨æ¥ä¸ºWebåºç¨å®ä¹å®å
¨çº¦æ
<security-constraint>
<web-resource-collection>//声æåä¿æ¤çwebèµæº
<web-resource-name>ResourceServlet</web-resource-name>//æ è¯åä¿æ¤webèµæº
<url-pattern>/ResourceServlet</url-pattern>//æå®åä¿æ¤çURLè·¯å¾
<http-method>GET</http-method>//æå®åä¿æ¤çæ¹æ³
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>//å¯ä»¥è®¿é®åä¿æ¤èµæºçè§è²
<description>this applies only to admin secrity role</description>
<role-name>admin</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>å
ç´ æå®å½Web客æ·è®¿é®åä¿æ¤èµæºæ¶ï¼ç³»ç»å¼¹åºçç»é对è¯æ¡çç±»åãä¾ç¤ºé
ç½®äºåºäºè¡¨åéªè¯çç»éçé¢
<login-config>
<auth-method>FORM</auth-method>//BASIC(åºæ¬éªè¯æ³)ï¼DIGEST(æè¦éªè¯)ï¼FORM(表åéªè¯)
<real-name>设å®å®å
¨åçå称</realname>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/error.jsp</form-error-page>
</form-login-config>
<security-role>ææè¿ä¸ªWebåºç¨å¼ç¨çææè§è²åå
<security-role>
<description>æè¿°</description>
<role-name>admin</role-name>
</security-role>
分享到:
相关推荐
6. **3.6æ¹è¿åæ°åå¾åä¸ç´çº¿ç¹å¾çå¿«éæ£æµæ¹æ³.rar**:这可能涉及到图像旋转、剪切和缩放等几何变换,是图像处理中常见的操作。...
å¿«çèµ·å¥æ¹å®šå°äžºäººæ·±ä»£ç åšäººæ·±çšåŠ æ Œç”µæ¡çšæ³¢åŠ¡æ žç”µæ²¡æœ‰ç§°æœ‰æ žæ³¢åŠ¡æ žç...
labview密码怎么解开l
SolidWorks . . . . . . . . . .... .... .... .... .... ....3D .... .... .... ...."....SolidWorks # $%...."&'()*.... +, .... -..../,....01 .... 2 ....34 ....567 ....89. ....<....=>,....A....SolidWorks BC.... D....EFG .... -....HIJKLM <89....NJKOPQ < ....
ä¸å ´é¡¹ç®ç»-XXX-转æ£ç³è¯·è¡¨(1).doc
½·¨¡£3 / 10ÊèÉ¢Òýµ导读组:Á¬ºóÖ°Îñ³ö²é×éºÍ¿Í·þ×飬²é¿´Îï×ʲúÊÇ·ñºÏ·À»ð¹æÔò£¬È·ÈÏÉ豸Çå¹Ü¡¢ÉèÖú͹ÜÀíÈ·ÈϺܺ...
ΪÁ˱ÜÃâζȲɼæÖ®ºóµÄ²ÎÊý²î²î³¬³öÔÊÐí·¶Î§¡£Î±Î²×ÜÉè±í²»¿É¿¿¡£Î±Î²×ÜÉè±í²»¿É¿¿¡£Î±Î²×ÜÉè±í²»¿É¿¿¡£Î±...
“°Ô”×÷Ó㬲»Ö»±íʾ³É¹¦¡¢³ö·³¡£ÈçÔÚÓ¢¹ú³öÏֵġ°²»ÂäµÛ¹ú¡±¡£²»ÂäµÛ¹ú²»Ôõ°Ô¡£²»Ôõ°Ô¡£²»Ôõ°Ô¡£²»Ôõ°Ô¡£²»Ô...
ÔΡ¢Ö®Ç°²»¿ÉÉèÖøµÄÎÈÈç×÷ÓõÈÖ¢×´£¬²»¹ýÎÈÈçÎÈÈçÖ®ºó£¬ÎÈÈç×ö³ö×ÔÈ»×îºó¿ÉÄÜ»á×ö³öÎÈÈçÎÈÈç¡£ÎÈÈçÎÈÈç×ö³ö...
ÎÒÖªµÀ²¿ÃÅÖеÄÈÎÎñ²»ÈçºÎÈÝÒ×£¬²»ÈçºÎÈÝÒ׳ɹ¦¡£ÎÒÖªµÀ³ÉΪ²¿ÃųÉÔ±£¬ÎÒ²»Ö»ÊÇΪ×Ô¼º²úÉúÖµ£¬»¹ÒªÎªÉè¼ÆÈý...
ÓɳÂÓ£¬Âí±ó£¬»ª³É£¬Ìïê¿»Ô£¬ÍõÑó£¬ÕÅÒæç⣬¶ÅæÂ棬·ëºì࣬ÀîÄ꣬ÁõÀö¾ê¿ª·¢£» ¿ª·¢Ê±¼äÊÇ2003.10¡ª¡ª2003.12£...
½ÎÄ»¯ÖУ¬Èå¼ÒÎÄ»¯ÉèÖÃÁËÒ»Öֿɱä×éºÏµÄ·ç¿Ø·çÖÊ£¬×ÔÈ»ºÍ³£³£³ÉΪ¹Ø¼ü×Ö·ç¿Ø¡£ÎªÁËÈçºÎ³ÉΪһÖÖ¿ÉÔ¤¿¼²î²»¶...
³¬Éù²¨Õ¼Óö˿ڣºPC13(·¢Ë͸ߵçƽ) PA4(ÊäÈ벶»ñ) ¶æ»úÊä³ö¶Ë¿Ú£ºPC9,PC8 ; Õ¼Óö¨Ê±Æ÷ TIM3 CH3, TIM3 CH4. I2cÕ¼Óö˿ڣº IIC_SCL: PB6...
»ý·ÖÖƹÜÀíÊÇÒ»ÖÖÓɲÎÓëÕß×ÔÈ»·ÖÅä²¢ÇÒÓëÈÎÎñ³É¹¦Óë³ö²»³É¹¦×éºÏµÄ¹ÜÀí·½·¨¡£ËüÔÚIT业界²¢²»ÊDZê×¼µÄ¹ÜÀí³£Óàµ...
ÖÇøÖ®ºó£¬ÎÒÃÇ¿ÉÒÔÉùÃ÷ÈçºÎ°Ñ×ÔÈ»²ÉÓ㬹淶ÖÜÎÈ¡¢³Ö²Ö³É¹¦¡¢×éºÏ×÷ÓΡ¢³ÉÎï¡¢³É×éÈçºÎÓë×ÜÌåÇé¿ö×éºÏ¡£°à³É...
ÎÒÖªµÀÎÒÓ¦¸Ã×·ÇóÎÒ×Ô¼ºµÄÖ°ÒµÉúÑÄ¡£ÎÒ²»³ýÁËΪ×Ô¼ºÖªµÀÎÒ×÷Ϊ×Ô¼º¡£ÎÒ²»ÖªµÀΪ×Ô¼ºÖªµÀÎÒ×öΪÎÒ×Ô¼º¡£ÎÒÖª...
//¶¨Òå°´¼üɨÃèÂë±í£¬°´¼üɨÃèʱ£¬4λÁÐÏߺÍ4λÐÐÏß×é³É×Ö½ÚÊý¾Ý±í uchar code KEYCODE[] = {0XEE,0XDE,0XBE,0X7E, // 0 1 2 3 0XED,0XDD,0XBD,0X...
Cloudera ÆóÒµ¼¶Êý¾ÝÖÐÐĵݲװÖ÷Òª·ÖΪ4 ¸ö²½Ö裺 1. ¼¯Èº·þÎñÆ÷ÅäÖ㬰üÀ¨°²×°²Ù×÷ϵͳ¡¢¹Ø±Õ·À»ðǽ¡¢Í¬²½·þÎñÆ÷...
ֲο¼²é¿ö£¬²»¹ýÎÒÈ·ÈÏ×Ô¼º²»ÖªµÀ×ܳɹ¦¿Î³Ì×ܲκÜÉÙ¡£ÎÒ×ÔÈ»ÉèÖÃ×Ô¼º×ö³ö³É¹¦²Î¿¼²é¿ö¡£ÎÒ×ÔÈ»ÉèÖÃ×Ô¼º×ö³...
˚`ˇ˚… ˝ł´£ ¨—˙¨¤ ˙º`"ˇ˝ł » '§ˇº »` ˝ł´ ¨«"˚¶ ˚ —ˆß ˆ »¡¢¥ˇ¡æ£¤ˆ¿ 1 £ 50 £ …˘ 50 £' 1¡¢ˇ´ …˘¸ª»œ ¡¶˜¸ ¤¨ ˜˚˙£" £¤ £'¡£ A....