MapleStory Finger Point

๐ŸŸค JAVA/๐ŸŸค JSP

[JSP] ๋””๋ ‰ํ‹ฐ๋ธŒ Directive ๋ž€?

HYEJU01 2024. 8. 23. 23:51

๐Ÿ”น  ๋””๋ ‰ํ‹ฐ๋ธŒ Directive

JSP ํŽ˜์ด์ง€์˜ ์ „๋ฐ˜์ ์ธ ์„ค์ •์„ ์ •์˜ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋œ๋‹ค. (์†์„ฑ ์ง€์ •)

<%@ page contentType = "text/html; charset=utf-8" %>

 

page ํŽ˜์ด์ง€ ์ •๋ณด ์ง€์ • 
taglib ์‚ฌ์šฉ ํ•  ํƒœ๊ทธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ง€์ •
include ํŠน์ • ์˜์—ญ์— ๋‹ค๋ฅธ ๋ฌธ์„œ ํฌํ•จ์‹œํ‚จ๋‹ค.

 

 

๐Ÿ”น page ๋””๋ ‰ํ‹ฐ๋ธŒ

jsp ํŽ˜์ด์ง€ ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•˜๊ธฐ ์œ„ํ•ด์„œ ์‚ฌ์šฉ ๋œ๋‹ค.

 

 

๐Ÿ”น page ๋””๋ ‰ํ‹ฐ๋ธŒ ์ฃผ์š” ์†์„ฑ

contentType JSP ํŽ˜์ด์ง€์˜ MIME ํƒ€์ž…๊ณผ ๋ฌธ์ž ์ธ์ฝ”๋”ฉ์„ ์„ค์ • <%@ page contentType="text/html; charset=UTF-8" %>
import JSP ํŽ˜์ด์ง€์—์„œ ์‚ฌ์šฉํ•  ์ž๋ฐ” ํด๋ž˜์Šค๋‚˜ ํŒจํ‚ค์ง€๋ฅผ ์ž„ํฌํŠธ <%@ page import="java.util.*, java.text.*" %>
trimDirectiveWhitespaces JSP ๋””๋ ‰ํ‹ฐ๋ธŒ ์ฃผ์œ„์˜ ๊ณต๋ฐฑ์„ ์ œ๊ฑฐํ• ์ง€๋ฅผ ์ง€์ • <%@ page trimDirectiveWhitespaces="true" %>
pageEncoding JSP ํŽ˜์ด์ง€์˜ ๋ฌธ์ž ์ธ์ฝ”๋”ฉ์„ ์„ค์ • <%@ page pageEncoding="UTF-8" %>
๋“ฑ๋“ฑ....    

 

 




 

 

1) page : ํŽ˜์ด์ง€๊ธฐ๋ณธ์„ค์ • <%page ์†์„ฑ=“์†์„ฑ๊ฐ’”>
<%@ page language="java" contentType="text/html; charset=UTF-8“ pageEncoding="UTF-8"%> 

2) include : include file ์„ค์ • <%include file=“ํŒŒ์ผ๋ช…”>
<%@ include file=“header.jsp"%> 

3) taglib : ์™ธ๋ถ€๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌํƒœ๊ทธ์„ค์ • 
<%taglib uri=“uri” prefix=“๋„ค์ž„์ŠคํŽ˜์ด์Šค๋ช…”>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix=“c"%>