3week
JSP์ ์ญํ ์ ํฐ์บฃ์ ๊ธฐ๋ฐ์ผ๋ก ๋์ํ๋ฉฐ ํฌ๋กฌ์์ HTTP request ํ๋กํ ์ฝ์ ๋ฐ์์ ์ฒ๋ฆฌํ์ฌ HTTP response ํ๋กํ ์ฝ์ ๋ง๋ค์ด์ ํฌ๋กฌ์ ์ ๋ฌํ๋ค. ํฌ๋กฌ V8์ ๊ธฐ์ค์ผ๋ก js์ html,css๊ฐ ๋์๊ฐ๋ ๊ฒ์ด๋ค.
# ํ๊ธ ํ๊ธฐ๋ฅผ ๊นจ์ง์ง ์๊ณ ์ ๋์ ๊ฐ ์ ์๊ฒ ์ฝ๋๋ฅผ ์์ฑ
<%@ page contentType="text/html; charset=utf-8" %>
<html>
<head>
<title>Directives Tag</title>
</head>
<body>
<h2>contentType ๋๋ ํฐ๋ธ ํ๊ทธ</h2>
<h4>text/html : HTML ์ถ๋ ฅ</h4>
<h4>charset=utf-8 : ๋ฌธ์ ์ธ์ฝ๋ฉ</h4>
</body>
</html>
<%@ page pageEncoding= "utf-8"%>
<html>
<head>
<title>Directives Tag</title>
</head>
<body>
<h2>contentType ๋๋ ํฐ๋ธ ํ๊ทธ</h2>
<h4>text/html : HTML ์ถ๋ ฅ</h4>
<h4>charset=utf-8 : ๋ฌธ์ ์ธ์ฝ๋ฉ</h4>
</body>
</html>
์ด๋ ๊ฒ ๋๊ฐ์ง ๋ฐฉ๋ฒ์ด ์์ง๋ง ์ฒซ ๋ฒ์งธ ๋๋ ํฐ๋ธ๋ ๋ธ๋ผ์ฐ์ ์ ์ ์ก๋๋ ์ฝํ ์ธ ์ ํ์ ๊ณผ ํด๋น ์ฝํ ์ธ ์ ๋ฌธ์ ์ธ์ฝ๋ฉ์ ์ค์ ํ๋ ๋ฐ๋ฉด, ๋ ๋ฒ์งธ ๋๋ ํฐ๋ธ๋ JSP ํ์ด์ง ๋ด์ ์์ค ์ฝ๋์ ์ธ์ฝ๋ฉ์ ์ค์ ํฉ๋๋ค.
# ์ธ๋ถ jspํ์ผ์ ํฌํจ ์์ผ๋ณด์
<%@ page contentType="text/html; charset=utf-8"%>
<html>
<head>
<title>Directives Tag</title>
</head>
<body>
<h4>ํค๋ ํ์ด์ง ์์ญ์
๋๋ค</h4>
</body>
</html>
์์ ์ฝ๋์ฒ๋ผ include01_ header.jspํ์ผ์ ์์ฑํ๊ณ ์ด ํ์ผ์ include01.jspํ์ผ์ ํฌํจ ์์ผ๋ณด๋ ค๊ณ ํ๋ค.
<%@ page contentType="text/html; charset=utf-8"%>
<html>
<head>
<title>Directives Tag</title>
</head>
<body>
<%@ include file="include01_header.jsp"%>
<h4>---------- ํ์ฌ ํ์ด์ง ์์ญ -------------</h4>
</body>
</html>
์์ ์ฝ๋ ์ฒ๋ผ <%@ include file="include01_header.jsp"%>๋ฅผ ์ฝ์ ํด์ include01_ header.jspํ์ผ์ ๊ฐ์ ธ์ฌ ์ ์๋ค. ์ด๋ ๊ฒ ์ฝ๋๋ฅผ ์์ฑํ๊ณ ํฐ์บฃ์ ํตํด์ ํฌ๋กฌ์ผ๋ก ๋ธ๋ผ์ฐ์ ์ ๋์ฐ๋ฉด ์๋์ ๊ฐ์ ๊ฒฐ๊ณผ๊ฐ ๋์จ๋ค.
