728x90
반응형
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%-- src/main/webapp/ch03/includeDirectiveex1.jsp --%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>include 지시어 예제</title>
</head>
<body>
<% String msg = "includeDirectiveex1.jsp 페이지의 msg 변수"; %>
<h1>includeDirectiveex1.jsp 입니다.</h1>
<%@ include file = "includeDirectiveex2.jsp" %>
<h2>include Directive(지시어)를 이용하여 다른 페이지를 포함 할수 있습니다.
두개의 jsp 페이지는 하나의 서블릿으로 변환되므로 변수의 공유가 가능합니다.</h2>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%-- src/main/webapp/ch03/includeDirectiveex2.jsp --%>
<%-- includeDirectiveex1.jsp 페이지에 포함되는 페이지--%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<hr>
<h3>includeDirectiveex2.jsp 페이지 입니다. <br>
includeDirectiveex1.jsp 호출시 포함되는 페이지 입니다. <br>
두개의 페이지가 같은 서블릿으로 변경되므로 변수가 공유됩니다. <br>
msg : <%=msg %>
<hr>
</h3>
</body>
</html>
728x90
반응형