jsp包含文件的两种方法

 1 //第一种:include指令:当JSP转换成Servlet时引入指定文件 <%@ page contentType="text/html; charset=GB2312" language="java" errorPage=""%>    
 2 <%@ include file="head.jsp"%>   
 3 <%@ include file="body.jsp"%>   
 4 <%@ include file="tail.jsp"%>   
 5 //第二种:<jsp:include>动作元素:当JSP页面被请求时引入指定文件    
 6 <%@ page contentType="text/html; charset=GB2312" language="java" errorPage=""%>   
 7 <jsp:include page="head.jsp"/>   
 8 <jsp:include page="body.jsp"/>   
 9 <jsp:include page="tail.jsp"/>   
10   
11   
12 //第二种方法可以很方便的用<jsp:param>来向所包含页传递参数,方法如下:    
13 <%@ page contentType="text/html; charset=GB2312" language="java" errorPage=""%>   
14 <jsp:include page="head.jsp"/>   
15 <jsp:include page="body.jsp">   
16 <jsp:param name="uid" value="username"/>   
17 <jsp:param name="pwd" value="password"/>   
18 </jsp:include>   
19 <jsp:include page="tail.jsp"/>   
原文地址:https://www.cnblogs.com/elleniou/p/2678134.html