JSPÖÐʹÓÃIncludeÓëJSP£ºIncludeµÄÇø±ð
ÎÒÃǶ¼ÖªµÀÔÚjspÖÐincludeÓÐÁ½ÖÖÐÎʽ,·Ö±ðÊÇ
< %@ include file=” ”% >
< jsp:include page=” ” flush=”true”/ >
Ç°ÕßÊÇÖ¸ÁîÔªËØ¡¢ºóÕßÊÇÐÐΪԪËØ¡£
¾ßÌåËüÃǽ«Ôںδ¦Óã¿ÈçºÎÓü°ËüÃÇÓÐʲôÇø±ð£¿ÕâÓ¦¸ÃÊǺܶàÈË¿´µ½Ëü¶¼»áÏëµ½µÄÎÊÌâ¡£ÏÂÃæÒ»ÆðÀ´¿´¿´°É¡£
ͨ³£µ±Ó¦ÓóÌÐòÖÐËùÓеÄÒ³ÃæµÄijЩ²¿·Ö£¨ÀýÈç±êÌâ¡¢Ò³½ÅºÍµ¼º½À¸£©¶¼ÏàͬµÄʱºò£¬ÎÒÃǾͿÉÒÔ¿¼ÂÇÓÃinclude¡£¾ßÌåÔÚÄÄЩʱºòÓÃ< % @ include file=” ”% >£¬ÄÄЩʱºòÓÃ< jsp:include page=” ” flush=”true”/ >. ÕâÖÖÐÎʽ¡£Ê×ÏÈÒªÃ÷°×µÄÊÇËüÃÇÖ®¼äµÄÇø±ð¡£Ö»ÓÐÁ˽âÁËËüÃÇÓ÷¨µÄ²»Í¬²ÅÀí½â¸ÃÔÚºÎʱȥÓÃÒÔ¼°ÈçºÎÑ¡Ôñ¡£
< %@ include file=” ”% >,jspµÄincludeÖ¸ÁîÔªËضÁÈëÖ¸¶¨Ò³ÃæµÄÄÚÈÝ¡£²¢°ÑÕâЩÄÚÈݺÍÔÀ´µÄÒ³ÃæÈںϵ½Ò»Æð¡££¨Õâ¸ö¹ý³ÌÊÇÔÚ·Òë½×¶Î:Ò²¾ÍÊÇjsp±»×ª»¯³ÉservletµÄ½×¶Î½øÐеġ£
ÕâÀï¶Ô·Òë½×¶Î½øÐÐÒ»ÏÂ˵Ã÷:ÎÒÃÇÖªµÀ£¬jspÒ³Ãæ²»ÄÜÔ·â²»¶¯µØ±»´«Ë͸øä¯ÀÀÆ÷£¬ËùÓеÄjspÔªËض¼±ØÐëÊ×ÏÈÓÉ·þÎñÆ÷½øÐд¦Àí¡£ÕâÊÇͨ¹ý½«jspÒ³Ãæת´ï»¯³Éservlet£¬È»ºóÖ´ÐÐÕâ¸öservletÀ´Íê³ÉµÄ¡£·þÎñÆ÷ÐèÒªÒ»¸öjspÈÝÆ÷À´´¦ÀíjspÒ³Ãæ¡£jspÈÝÆ÷ͨ³£ÒÔservletµÄÐÎʽÀ´ÊµÏÖ£¬Õâ¸öservlet¾¹ýÅäÖ㬿ÉÒÔ´¦Àí¶ÔjspÒ³ÃæµÄËùÓÐÇëÇó¡£
JspÈÝÆ÷¸ºÔð½«jspÒ³Ãæת»¯³Éservlet£¨³ÆΪjspÒ³ÃæʵÏÖÀà?JSP Page implementation class£©,²¢±àÒëÕâ¸öservlet¡£ÕâÁ½²½¾Í¹¹³ÉÁË·Òë½×¶Î.
ÓÉ´ËÎÒÃǾͻáÖªµÀ£ºjspÒ³ÃæÊÇ°ÑincludeÖ¸ÁîÔªËØËùÖ¸¶¨µÄÒ³ÃæµÄʵ¼ÊÄÚÈÝ£¨Ò²¾ÍÊÇ´úÂë¶Î£©¼ÓÈëµ½ÒýÈëËüµÄjspÒ³ÃæÖÐ,ºÏ³ÉÒ»¸öÎļþºó±»jspÈÝÆ÷½«Ëüת»¯³Éservlet¡£¿ÉÒÔ¿´µ½Õâʱ»á²úÉúÒ»¸öÁÙʱclassÎļþºÍÒ»¸öjavaÎļþ¡£ÏÂÃæ¾Ù¸öÀý×Ó¡£
·þÎñÆ÷ÓÃtomcat£¬ÒýÈëÒ³ÃæµÄjspÎļþ½Ðtest.jsp¡£±»ÒýÈëµÄÒ³Ãæ½Ðdate.jsp.Õâ¸öjspÎļþÀï´æ·ÅµÄÊÇÒ»¸öÓйØʱ¼äµÄjsp´úÂë,µ±Ç°µÄÉÏÏÂÎĸùÉèΪtest
//======date.jspµÄÔ´Îļþ=====//
<%@ page language=”java” contentType="text/html;charset=gb2312"%>
<%
java.util.Date date=new java.util.Date();
String date_cn ="";
String dateStr = "";
switch(date.getDay())
{
case 0:date_cn ="ÈÕ"; break;
case 1:date_cn ="Ò»"; break;
case 2:date_cn ="¶þ"; break;
case 3:date_cn ="Èý"; break;
case 4:date_cn ="ËÄ"; break;
case 5:dat
Ïà¹ØÎĵµ£º
Èç¹ûweb.xmlÀïÃæµÄ<web-app>ÊÇversion="2.4"£¬ÄÇô¾ÍÒªÔÚ<jsp-property-group>ÀïÉèÖá£Èç¹ûversion="2.5"¾Í²»ÐèÒª¡£
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/javae ......
Ò»£¬jsp³öÏֵĵÄÔÒò
¿´Á½¶Î´úÂëµÄ¶Ô±È
1 servletʵÏÖ
public class Welcome extends HttpServlet {
int num = 1;
public void doGet(HttpServletRequest request,
&nbs ......
servlet APIµÄ2.3°æ±¾ÖÐ×îÖØÒªµÄÒ»¸öй¦ÄܾÍÊÇÄܹ»ÎªservletºÍJSPÒ³Ã涨Òå¹ýÂËÆ÷¡£¹ýÂËÆ÷ÌṩÁËijЩÔçÆÚ·þÎñÆ÷ËùÖ§³ÖµÄ·Ç±ê×¼
“servletÁ´½Ó”µÄÒ»ÖÖ¹¦ÄÜÇ¿´óÇÒ±ê×¼µÄÌæ´úÆ·¡£
¹ýÂËÆ÷ÊÇÒ»¸ö³ÌÐò£¬ËüÏÈÓÚÓëÖ®Ïà¹ØµÄservlet»òJSPÒ³ÃæÔËÐÐÔÚ·þÎñÆ÷ÉÏ¡£¹ýÂËÆ÷¿É
¸½¼Óµ½Ò»¸ö»ò¶à¸öservlet»òJSPÒ³ÃæÉÏ£¬²¢ÇÒ¿É ......
×öB/SµÄÆóÒµ¼¶Ó¦Ó㬿ÉÄÜ»áÓöµ½ÕâÑùÒ»ÖÖÇé¿ö£¬¿Í»§µÄÎĵµ£¨wordµÈ£©±£´æÔÚÒ»¸öĿ¼Ï£¬ÐèҪͨ¹ýµÇ¼²ÅÄÜ¿´µ½£¬µ«ÊÇ
ÕâЩÓÖ¶¼ÊǾ²Ì¬µØÖ·£¬ËùÒÔÄÜÖ±½ÓÊäÈëµØÖ·¾Í¿ÉÒÔ·ÃÎʵ½Îĵµ¡£Õâʱ¾ÍÐèÒªÓõ½Filter¹ýÂËÆ÷ÁË¡£
Servlet
APIµÄ2.3°æ±¾µÄÒ»¸öй¦ÄܾÍÊÇÄܹ»ÎªservletºÍJSPÒ³Ã涨Òå¹ýÂËÆ÷¡£¹ýÂËÆ÷ÌṩÁËijЩÔçÆÚ·þÎñÆ÷Ë ......