include 액션 태그
<jsp:include page=”포함될 페이지” flush=”false”/>
(flush 강제로 비울지말지 정하는 거)
<jsp:include page=”포함될 페이지” flush=”false”></jsp:include>
<jsp:include page=”포함될 페이지”>
<jsp:param name="파라미터 이름1" valuse="파라미터 값1" />
<jsp:param name="파라미터 이름2" valuse="파라미터 값2" />
</jsp:include>
<jsp:include page=”test/include.jsp”>
<jsp:param name="id" valuse="lee" />
<jsp:param name="password" valuse="1234" />
</jsp:include>
<jsp:include page=”test/include.jsp?id=lee&password=1234”>
예제
includeTest.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%request.setCharacterEncoding("utf-8"); %>
<html>
<head>
<meta charset="UTF-8">
<title>Include Test</title>
<h2>Include Action Test</h2>
</head>
<body>
<jsp:include page="includeTest2.jsp">
<jsp:param name="name" value="kim" />
</jsp:include>
</body>
</html>
includeTest2.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String name=request.getParameter("name");
%>
<b><%=name %></b>
includeTest.jsp 실행 시 화면
개발자 도구로 확인 시
include 액션 태그 사용 시 실행 순서
클라이언트→includeTest.jsp(include(1)→ include 위치에결과 삽입(3)) ↔includeTest2(2).jsp