includeºÍjsp:include
index.jsp:
<html>
<head>
<title>The News</title>
</head>
<body>
<h1> Latest News</h1>
<table>
<tr>
<td><h3><%@include file="items/news1.jsp" %></h3></td>
</tr>
<tr>
<td><h3><jsp:include page="items/news1.jsp"/></h3></td>
</tr>
</table>
</body>
</html>
items/news1.jsp:
Sharks attacked <%@ include file="news2.jsp" %>, <jsp:include page="news2.jsp"/> survived!
items/news2.jsp:
swimmers
news2.jsp:
nobody
index.jspÊä³ö£º
Latest News
Sharks attacked swimmers, nobody survived!
Sharks attacked swimmers, swimmers survived!
<% @include %>Ö¸ÁîÔÚ·Òë½×¶Î»á°ÑÒ³Ãæ°üº¬½øÀ´£¬<jsp:include>¶¯×÷ÔòÔÚÇëÇóʱִÐС£
Ïà¹ØÎĵµ£º
ÉÏÍø¿´Á˺ö࣬¾ÍÕâһƪ½â¾öÁËÎÒµÄÎÊÌ⣬ÏÖת£¬ÎÒµÄÏîÄ¿ÓõÄÊÇMVC¼Ü¹¹£¬ÓÐͳһµÄ¿ØÖÆÆ÷£¬×ªÏò²»Í¬µÄAction£¬ÉÏÍø¿´Á˺ö࣬´ó²¿·ÖÊÇ˵¼ÓÈërequest.setCharacterEncoding("utf-8");µ«ÊǾ¹ýÎÒµÄÊÔÑ飬ÕâÖ»ÓÐÔÚÀûÓÃJSP´¦Àí±íµ¥´«ÊäÊý¾Ýʱ²Å¿ÉÓã¬ÔÚÎҵĶ«Î÷ÖÐÎÞ·¨½â¾ö£¬ºóÀ´·¢ÏÖ»¹ÊÇÓÃFilterChainºÃ£¬ºÇºÇ£¬Öص㻹ÊÇÔÚrequest ......
Cookie¸ÅÄî:
CookieµÄ¸ñʽʵ¼ÊÉÏÊÇÒ»¶Î´¿Îı¾ÐÅÏ¢, ÓÉ·þÎñÆ÷Ëæ×ÅÍøÒ³Ò»Æð·¢Ë͵½¿Í»§¶Ë, ²¢±£´æÔÚ¿Í»§¶ËÓ²ÅÌÖÐÖ¸¶¨µÄĿ¼µÄ. ´ó¼Ò¶¼´«ËµCookie»áÔì³ÉÑÏÖصݲȫÍþвʲôµÄ, Æäʵ²»ÊÇÕâô»ØÊÂÇé. ·þÎñÆ÷¶ÁÈ¡CookieµÄʱºò, Ö»Äܹ»¶ÁÈ¡µ½Õâ¸ö·þÎñÆ÷Ïà¹ØµÄÐÅÏ¢. ¶øÇÒ, ä¯ÀÀÆ÷Ò»°ãÖ»ÔÊÐí´æ·Å300¸öCoo ......
4.1 ±íµ¥Êý¾Ý¸ÅÊö
¡¡¡¡ Èç¹ûÄãÔø¾Ê¹ÓùýWebËÑË÷ÒýÇ棬»òÕßä¯ÀÀ¹ýÔÚÏßÊéµê¡¢¹ÉƱ¼Û¸ñ¡¢»úƱÐÅÏ¢£¬»òÐí»áÁôÒ⵽һЩ¹Å¹ÖµÄURL£¬±ÈÈç“http://host/path?user=Marty+Hall&origin=bwi&dest=lax”¡£Õâ¸öURLÖÐλÓÚÎʺźóÃæµÄ²¿·Ö£¬¼´“user=Marty+Hall&origin=bwi&dest=lax”£¬¾ÍÊÇ±íµ¥Êý ......
Ò»¡¢JSPÒ³ÃæÏÔʾÂÒÂë
¶þ¡¢±íµ¥Ìá½»ÖÐÎÄʱ³öÏÖÂÒÂë
Èý¡¢Êý¾Ý¿âÁ¬½Óʱ³öÏÖÂÒÂë
´ó¼ÒÔÚJSPµÄ¿ª·¢¹ý³ÌÖУ¬¾³£³öÏÖÖÐÎÄÂÒÂëµÄÎÊÌ⣬¿ÉÄÜÒ»ÖÁÀ§ÈÅ×ÅÄú£¬ÎÒÏÖÔÚ°ÑÎÒÔÚJSP¿ª·¢ÖÐÓöµ½µÄÖÐÎÄÂÒÂëµÄÎÊÌâ¼°½â¾ö°ì·¨Ð´³öÀ´¹©´ó¼Ò²Î¿¼¡£
Ò»¡¢JSPÒ³ÃæÏÔʾÂÒÂë
ÏÂÃæµÄÏÔʾҳÃæ(display.jsp)¾ ......
ÎÒÃǶ¼ÖªµÀÔÚjspÖÐincludeÓÐÁ½ÖÖÐÎʽ,·Ö±ðÊÇ
<%@ include file=" "%>
<jsp:include page=" " flush="true"/>
Ç°ÕßÊÇÖ¸ÁîÔªËØ¡¢ºóÕßÊÇÐÐΪԪËØ.
ͨ³£µ±Ó¦ÓóÌÐòÖÐËùÓеÄÒ³ÃæµÄijЩ²¿·Ö(ÀýÈç±êÌâ¡¢Ò³½ÅºÍµ¼º½À¸)¶¼ÏàͬµÄʱºò,Î ......