include : 다른 페이지를 현재 페이지에 포함시키는 태그
● <jsp:include> include 액션태그
클라이언트 측의 include
각각의 페이지마다 별도의 서블릿으로 만들어서 포함시킴
<!-- includeTagBody.jsp -->
<body>
<h1>Include Tag Example1</h1>
<jsp:include page="includeTagTop.jsp" /> // 여기에 includeTagTop.jsp가 들어감
include ActionTag의 BODY 입니다.
</body>
<!-- includeTagTop.jsp -->
<%
String name = "Hello";
%>
include ActionTag의 TOP입니다.
<p />
<%= name %> Fighting!!
<br>
<!-- 결과 -->
Include Tag Example1
include ActionTag의 TOP입니다.
Hello Fighting!!
include ActionTag의 BODY 입니다.
● <%@ include %> include 지시어
서버 측의 include
소스로 붙여 하나의 서블릿으로 만듬 (includeTagMain_jsp.java만 생성)
<!-- includeTagMain.jsp -->
<%@ include file="includeTop.jsp" %>
include지시자의 Body 부분입니다.<br>
<%@ include file="includeBottom.jsp" %>
<!-- includeTop.jsp -->
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
include지시자의 Top 부분입니다.<br>
</body>
</html>
<!-- includeBottom.jsp -->
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
include지시자의 Bottom 부분입니다.<br>
</body>
</html>
<!-- 결과 -->
include지시자의 Top 부분입니다.
include지시자의 Body 부분입니다.
include지시자의 Bottom 부분입니다.
'Web > JSP&Servlet' 카테고리의 다른 글
에러페이지 (0) | 2020.08.07 |
---|---|
[JSP] forward 액션태그 (0) | 2020.08.03 |
MVC 패턴 (0) | 2020.08.02 |
자바 빈(Bean) (0) | 2020.08.01 |
JSP&Servlet 디렉토리 (0) | 2020.07.31 |