jsp:include 只不過是一個不同于
1.jsp include
<%@ page language="java" contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>JSP include element test</title>
</head>
<body>
This content is statically in the main JSP file.<br />
<%@ include file="included.html" %>
</body>
</html>
2.jsp:include
同上面是一個頁面,只不過這里轉(zhuǎn)成使用
<%@ page language="java" contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>JSP include element test</title>
</head>
<body>
This content is statically in the main JSP file.<br />
<jsp:include page="included.html" flush="true" />
</body>
</html>
include
的偽指令而已。 jsp:include
的優(yōu)點在于:它總是會檢查所含文件中的變化。而jsp include則不會, 可以認為是靜態(tài)包含。下面是兩則區(qū)別的代碼:1.jsp include
<%@ page language="java" contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>JSP include element test</title>
</head>
<body>
This content is statically in the main JSP file.<br />
<%@ include file="included.html" %>
</body>
</html>
2.jsp:include
同上面是一個頁面,只不過這里轉(zhuǎn)成使用
jsp:include
標(biāo)記<%@ page language="java" contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>JSP include element test</title>
</head>
<body>
This content is statically in the main JSP file.<br />
<jsp:include page="included.html" flush="true" />
</body>
</html>