JinSeong 2021. 10. 7. 18:58

04include.jsp์˜ ์ฝ”๋“œ๋‚ด์šฉ

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
04include

include ์ „
<%@include file="04included.jsp" %>
include ํ›„

<%=includedA %>
</body>
</html>

04included.jsp์˜ ์ฝ”๋“œ๋‚ด์šฉ

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
๋‚˜๋Š” included๋œ jspํŽ˜์ด์ง€
<%
	int includedA = 50;
%>
</body>
</html>

์ถœ๋ ฅ๋‚ด์šฉ

04include.jsp์˜ ์ถœ๋ ฅ์ด๋ฏธ์ง€

 

<%@include%>๋Š”????

์„ค๋ช…

  • ์„œ๋ฒ„์ธก include ๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด ๋œ๋‹ค ์ฆ‰ ์†Œ์Šค ์‹คํ–‰์ „์— include๊ฐ€ ๋œ๋‹ค๊ณ  ๋ณด์ž
  • ์†Œ์Šค ์‹คํ–‰์ „ ํฌํ•จ๋จ์œผ๋กœ ๋ณ€์ˆ˜๋ฅผ ๊ฐ™์ด ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค
  • ๋™์ ์œผ๋กœ ํŽ˜์ด์ง€ ํ• ๋‹น์„ ํ•  ์ˆ˜๊ฐ€ ์—†๋‹ค. ์ฆ‰ ์ •์ ์ธ ํŽ˜์ด์ง€์— ํ™œ์šฉ๋œ๋‹ค๋Š” ๊ฒƒ !

์†์„ฑ

  • file : ํฌํ•จ๋  ํŽ˜์ด์ง€๋ฅผ ๋ช…์‹œํ•œ๋‹ค

 

jsp:include VS include file ์ฐจ์ด๋ฅผ ์ž˜ ์ƒ๊ฐํ•  ๊ฒƒ ! ํ™œ์šฉํ•˜๋Š” ๊ณณ์ด ๋‹ค๋ฅผํ…Œ๋‹ˆ !