<P> 前面已經(jīng)介紹過(guò)include指令,它是在JSP文件被轉換成Servlet的時(shí)候引入文件,而這里的jsp:include動(dòng)作不同,插入文件的時(shí)間是在頁(yè)面被請求的時(shí)候。jsp:include動(dòng)作的文件引入時(shí)間決定了它的效率要稍微差一點(diǎn),而且被引用文件不能包含某些JSP代碼(例如不能設置HTTP頭),但它的靈活性卻要好得多。 </P>
<P> 例如,下面的JSP頁(yè)面把4則新聞?wù)迦胍粋(gè)“What's New ?”頁(yè)面。改變新聞?wù)獣r(shí)只需改變這四個(gè)文件,而主JSP頁(yè)面卻可以不作修改: </P>
<P> WhatsNew.jsp <BR><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><BR><HTML><BR><HEAD><BR><TITLE>W(wǎng)hat's New</TITLE><BR></HEAD></P>
<P><BODY BGCOLOR="#FDF5E6" TEXT="#000000" LINK="#0000EE"<BR> VLINK="#551A8B" ALINK="#FF0000"></P>
<P><CENTER><BR><TABLE BORDER=5 BGCOLOR="#EF8429"><BR> <TR><TH CLASS="TITLE"><BR> What's New at JspNews.com</TABLE><BR></CENTER><BR><P><BR>Here is a summary of our four most recent news stories:<BR><OL><BR> <LI><jsp:include page="news/Item1.html" flush="true"/><BR> <LI><jsp:include page="news/Item2.html" flush="true"/><BR> <LI><jsp:include page="news/Item3.html" flush="true"/><BR> <LI><jsp:include page="news/Item4.html" flush="true"/><BR></OL><BR></BODY><BR></HTML></P>