4.jsp:include动作和<%@ include的区别:
include指令把被包含的文件揉进来一起编译。include动作不是。它是在请求时,将输出结果包含进来。
例 4.4.1
jsp2.jsp:
<%! String name="mark-to-win"; %>
jsp1.jsp:
<html>
<body>
<%@ include file="jsp2.jsp" %>
<%= name %>
</body>
</html>
对 于上述jsp1.jsp,一旦去掉<%@ include file="jsp2.jsp" %>,eclipse编译器当时就不认识name这个变量了,jsp1.jsp编译时是需要把jsp2.jsp的纯文本拿过来放在一起重新一起编译 的。如果这时jsp1.jsp变成如下jsp动作,直接报错。(name cam not be resolved,这时jsp1.jsp拿不到jsp2.jsp的纯文本,只能拿到一个class文件)
<html>
<body>
<jsp:include page="jsp2.jsp" flush="true" />
<%= name %>
</body>
</html>
更多请见:http://www.mark-to-win.com/tutorial/jsp_3_DifferencejspincludeActionAndDirective.html