jspÖÐincludeµÄÁ½ÖÖÐÎʽ
jspÖÐincludeµÄÁ½ÖÖÐÎʽ: 1.<%@ include file=” ”%>
2.<jsp:include page=” ” flush=”true”/>
¶þÕßÖ÷ÒªÓÐÁ½¸ö·½ÃæµÄ²»Í¬;
£¨1£©:Ö´ÐÐʱ¼äÉÏ:
<%@ include file=”relativeURI”%> ÊÇÔÚ·Òë½×¶ÎÖ´ÐÐ
<jsp:include page=”relativeURI” flush=”true” /> ÔÚÇëÇó´¦Àí½×¶ÎÖ´ÐÐ.
£¨2£©:ÒýÈëÄÚÈݵIJ»Í¬:
<%@ include file=”relativeURI”%> ÒýÈ뾲̬Îı¾(html,jsp),ÔÚJSPÒ³Ã汻ת»¯³Éservlet֮ǰºÍËüÈں͵½Ò»Æð.
<jsp:include page=”relativeURI” flush=”true” /> ÒýÈëÖ´ÐÐÒ³Ãæ»òservletËùÉú³ÉµÄÓ¦´ðÎı¾.
Á½ÖÖÓ÷¨ÖÐfileºÍpageÊôÐÔ¶¼±»½âÊÍΪһ¸öÏà¶ÔµÄURI.Èç¹ûËüÒÔб¸Ü¿ªÍ·,ÄÇôËü¾ÍÊÇÒ»¸ö»·¾³Ïà¹ØµÄ·¾¶.½«¸ù¾Ý¸³¸øÓ¦ÓóÌÐòµÄURIµÄǰ׺½øÐнâÊÍ,Èç¹ûËü²»ÊÇÒÔб¸Ü¿ªÍ·,ÄÇô¾ÍÊÇÒ³ÃæÏà¹ØµÄ·¾¶,¾Í¸ù¾ÝÒýÈëÕâ¸öÎļþµÄÒ³ÃæËùÔڵķ¾¶½øÐнâÊÍ.
ÒÔÏÂÊÇʵ¼ÊÀý×ÓÀ´½âÊÍÒÔÉÏÄÚÈÝ£º
//======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())
{
&nbs
Ïà¹ØÎĵµ£º
404´íÎóÊÇʲôʱºò²úÉúµÄÄØ£¿µ±ÎÒÃÇͨ¹ýä¯ÀÀÆ÷ÇëÇó·þÎñÆ÷ÉϵÄij¸ö×ÊÔ´µÄʱºò£¬¿ÉÄÜÊÇJSP£¬Ò²¿ÉÄÜÊÇServlet£¬Èç¹ûÒª·ÃÎʵÄ×ÊÔ´²»´æÔÚ£¬¾Í»á²úÉú404´íÎó£¬404´íÎó¿ÉÄÜÊÇÓ¦Óñ¾ÉíµÄÎÊÌ⣬ÀýÈçûÓÐÕý³£²¿Êð¡¢Ãû×Öд´íÁË£¬Ò²¿ÉÄÜÊÇÎļþµÄÎÊÌ⣬JSPÎļþ²»´æÔÚ¡¢Ãû×Ö´íÎ󣬻òÕßServleûÓÐÅäÖá£
¸ù¾ÝÕâЩÇé¿ö£¬404´íÎóµÄ½â¾ ......
JSP/Servletת·¢ÓëÖض¨ÏòµÄÇø±ð
¾¡¹ÜHttpServletResponse.sendRedirect ·½·¨ºÍRequestDispatcher.forward ·½·¨¶¼¿ÉÒÔÈÃä¯ÀÀÆ÷»ñµÃÁíÍâÒ»¸öURLËùÖ¸ÏòµÄ×ÊÔ´£¬µ«Á½ÕßµÄÄÚ²¿ÔËÐлúÖÆÓÐןܴóµÄÇø±ð¡£
¡¡¡¡ÏÂÃæÊÇHttpServletResponse.sendRedirect ·½·¨ÊµÏÖµÄÇëÇóÖض¨ÏòÓëRequestDispatcher.forward ·½·¨ÊµÏÖµÄÇëÇó ......
JSPµÄÖ¸ÁîÊÇÓÃÀ´°üº¬ÍⲿÎļþ»òÊǽøÐÐÒ³ÃæÈ«¾ÖÉèÖõģ»ËüµÄÓÐÈýÖÖ£¬·Ö±ðÊÇpage£¬include£¬taglibÖ¸Áî
1.pageÖ¸Áî
ÐÎÈç<%@page ÊôÐÔ='Öµ' ÊôÐÔ='Öµ' ........ %>
ÊôÐÔÓУº
language=''java'' £º É趨jspÒ³ÃæµÄ½Å±¾ÓïÑÔ£¬Ä¿Ç°Ö»Ö§³Öjava£¬Ä¬ÈÏÊÇjava
......