MapleStory Finger Point

๐ŸŸค JAVA/๐ŸŸค JSP

[JSP] include ์•ก์…˜ ํƒœ๊ทธ (+๋ชจ๋“ˆํ™”)

HYEJU01 2024. 8. 24. 00:53

 

โ—ˆ <jsp:include  /> ์•ก์…˜ ํƒœ๊ทธ๋ž€? 

์›น ์‚ฌ์ดํŠธ์—์„œ ๊ณตํ†ต ๊ตฌ์„ฑ ์š”์†Œ (ํ—ค๋”,ํ‘ธํ„ฐ,๋„ค๋น„ ๋“ฑ) ๋“ค์„ ๊ณ„์† ์ž‘์„ฑํ•˜๊ฒŒ๋˜๋ฉด

์—„์ฒญ๋‚œ ์ฝ”๋“œ ์ค‘๋ณต์ด ์ผ์–ด๋‚œ๋‹ค... !!

์ด๋Ÿด ๋•Œ์—๋Š” <jsp:include> ๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๋ชจ๋“ˆํ™”์‹œ์ผœ ์ฝ”๋“œ ์ค‘๋ณต์„ ์—†์• ์ค€๋‹ค!

 

<jsp:include page="../include/admin-navigation.jsp"/>

<jsp:include page="ํฌํ•จํ•  ํŽ˜์ด์ง€" flush="true"/>

 

 

โ—ˆ include ์•ก์…˜ ํƒœ๊ทธ ๋™์ž‘ ๋ฐฉ์‹

 

1. ์›น ๋ธŒ๋ผ์šฐ์ € ์š”์ฒญ์„ ๋ฐ›์œผ๋ฉด abc.jsp

2. ์ฒซ ๋‚ด์šฉ A ๊ฐ€ ์ถœ๋ ฅ ๋ฒ„ํผ์— ์ €์žฅ๋˜๊ณ 

3. include ๊ฐ€ ์‹คํ–‰๋˜๋ฉด ์š”์ฒญ ํ๋ฆ„์„ include  b.jsp๋กœ ์ด๋™ํ•œ๋‹ค.

4. B ๊ฐ€ ์ถœ๋ ฅ ๋ฒ„ํผ์— ์ €์žฅ๋œ๋‹ค.

5. include  b.jsp ์‹คํ–‰์ด ๋๋‚˜๋ฉด ๋‹ค์‹œ abc.jsp ๋กœ ์ด๋™ํ•œ๋‹ค.

6. ๋งˆ์ง€๋ง‰ ๋‚ด์šฉ C ๊ฐ€ ์ถœ๋ ฅ ๋ฒ„ํผ์— ์ €์žฅ๋˜๊ณ 

7. ์ถœ๋ ฅ ๋ฒ„ํผ์˜ ๋‚ด์šฉ์„ ์‘๋‹ต ๋ฐ์ดํ„ฐ๋กœ ์ „์†กํ•œ๋‹ค.

 

โ—ˆ ์•ก์…˜ํƒœ๊ทธ ์†์„ฑ 

 

  • page: ํฌํ•จํ•  ๋ฆฌ์†Œ์Šค์˜ ๊ฒฝ๋กœ๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ์ปจํ…์ŠคํŠธ ๋ฃจํŠธ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•ฉ๋‹ˆ๋‹ค.
  • flush: ์„ ํƒ ์†์„ฑ์œผ๋กœ, ๊ธฐ๋ณธ๊ฐ’์€ true์ž…๋‹ˆ๋‹ค. ์ด ์†์„ฑ์€ ํ˜„์žฌ ํŽ˜์ด์ง€์˜ ์ถœ๋ ฅ ๋ฒ„ํผ๋ฅผ ํ”Œ๋Ÿฌ์‹œ(๋น„์šฐ๊ธฐ)ํ• ์ง€๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.