a.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
AAA PAGE
<%--
相当于:<% request.getRequestDispatcher("/include2/b.jsp").forward(request, response);%>
但是forward可以使用 jsp:param 子标签向 b.jsp 传入一些参数.
--%>
<jsp:forward page="/include2/b.jsp">
<jsp:param value="abcd" name="user"/>
</jsp:forward>
</body>
</html>
b.jsp:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
BBB PAGE
<%= request.getParameter("user")%>
<%= request.getParameter("pass")%>
</body>
</html>
c.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<!--
1). <jsp:include page="b.jsp"></jsp:include>
2). 动态引入: 并不是像 include 指令生成一个 Servlet 源文件, 而是生成两个 Servlet 源文件, 然后通过一个方法的方式把目标页面包含
进来.
可以使用 jsp:param 子标签向 b.jsp 传入一些参数.
-->
<jsp:include page="b.jsp">
<jsp:param value="1234" name="pass"/>
</jsp:include>
</body>
</html>