๐ Today I Learned(๊ฐ๋ฐ์ธ์ดํ์ต)/JSP
Day01(trimDirectiveWhitespaces, contentType)
JinSeong
2021. 10. 5. 18:06
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" trimDirectiveWhitespaces="true" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
์ค๋ ์ ์ฌ์ ํซ๋๊ทธ๋ค.
๋ฐํค์ค๋ฅผ ์ข์ํฉ๋๋ค.
์ฝ์นด์ฝ๋ผ
</body>
</html>
jsp์์ ๋ก๋ฉ๋ ํ์ด์ง์ ์์ค๋ณด๊ธฐ๋ฅผ ํด๋ณด๋ฉด ๊ณต๋ฐฑ์ผ๋ก ํ๊ธฐ๊ฐ ๋๊ฒ ๋ฉ๋๋ค.
trimDirectiveWhitespaces="true" ๋ก ์ง์ ํ ๊ฒฝ์ฐ์๋ ํด๋น ๊ณต๋ฐฑ์ ๋ชจ๋ ์ ๊ฑฐํด ์ค๋๋ค.
<%@ page language="java" contentType="text/plain; charset=UTF-8"
pageEncoding="UTF-8"%>
<!-- ์์ text/html์ text/plain์ผ๋ก ๋ฐ๊ฟ
xml, application/json ๋ฑ์ด ์์
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
04contentType
</body>
</html>
contentType์ ๋ง๊ทธ๋๋ก ์์ฑ๋๋ ์ฝ๋๋ฅผ ์ด๋ป๊ฒ ์ธ์ํ๊ฒ ํ ๊ฒ์ธ๊ฐ์ ๊ดํ ์์ฑ์ ์์ฑํ๋ ๊ณณ์ด๋ค.
'plain'๊ฐ์ ๊ฒฝ์ฐ๋ ๋ฐ์ ๋ด์ฉ์ ๊ทธ๋๋ก ์ถ๋ ฅํด์ค๋ค.
trimDirectiveWhitespaces="true"์ ์์ฑํ์ง ์์๊ธฐ๋๋ฌธ์ ์ถ๋ ฅ๋ด์ฉ ์์ชฝ์ ๊ณต๋ฐฑ์ด ์๊ธด๋ค.