- μ μ μΌλ‘ λ€λ₯Έ JSP νμ΄μ§λ₯Ό νμ¬ νμ΄μ§μ μ½μ νλ λ°©μμ΄λ€.(νμΌ ν¬ν¨ λ°©μ)
- μ»΄νμΌ μ λ‘λλλ―λ‘ λμ λ³κ²½μ΄ λΆκ°λ₯νλ€.
- νλμ μλΈλ¦Ώμ΄ μμ±λλ€.
<%@ include file="#" %>
<%-- π΅ src/main/webapp/lesson03/ex01/part1.jsp -->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<h1>Include Directive λ°©μμ
λλ€.</h1>
<%-- π΅ src/main/webapp/lesson03/ex01/layout.jsp -->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Include Directive</title>
</head>
<body>
<header>
<%@ include file="part1.jsp" %>
</header>
</body>
</html>
- λμ μΌλ‘ λ€λ₯Έ νμ΄μ§μ νμ¬ νμ΄μ§λ₯Ό μ½μ νλ λ°©μμ΄λ€.(νμ΄μ§ ν¬ν¨ λ°©μ)
- λ°νμ μ λ‘λλλ―λ‘ λμ λ³κ²½μ΄ κ°λ₯νλ€.
- κ° JSPλ§λ€ μλΈλ¦Ώμ΄ μμ±λλ€.
<jsp:include page="#" />
<%-- π΅ src/main/webapp/lesson03/ex02/part1.jsp -->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<h1>Include Action λ°©μμ
λλ€.</h1>
<%-- π΅ src/main/webapp/lesson03/ex02/layout.jsp -->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Include Action</title>
</head>
<body>
<header>
<jsp:include page="part1.jsp" />
</header>
</body>
</html>
μμ± | Include Directive | Include Action |
---|---|---|
μ½λ λ¬Έλ² | <%@ include file="#" %> | <jsp:include page="#" /> |
λ€λ₯Έ μ΄λ¦ | file include | page include |
μ½μ λ°©μ | JSP νμ΄μ§ μ½λκ° λ€λ₯Έ JSP νμ΄μ§ μ½λμ μ½μ | μλ΅μΌλ‘ λ°μ νμ΄μ§κ° λ€λ₯Έ νμ΄μ§μ μ½μ |
μΆλ ₯ λ°μΈλ©/Import | μ μ | λμ |
νμΌμ νΉμ± | ν¬ν¨λ νμ΄μ§κ° μμ£Ό λ³κ²½λμ§ μμ λ μ νΈλ¨ | ν¬ν¨λ νμ΄μ§κ° μμ£Ό λ³κ²½λ λ μ νΈλ¨ |
μμ±λλ μλΈλ¦Ώ μ | μ¬λ¬ κ°μ JSPμ λν΄ νλμ μλΈλ¦Ώμ΄ μμ±λ¨ | κ° JSPμ λν΄ κ°κ°μ μλΈλ¦Ώμ΄ μμ±λ¨ |
ν¬ν¨λλ νμΌ | μ»΄νμΌ μ λ‘λλ¨ | λ°νμ μ λ‘λλ¨ |
ν¬ν¨λλ νμΌμ λ³κ²½ μ¬νμ΄ μμ κ²½μ° | λ€μ μ»΄νμΌ μ λνλ¨ | λ€μ μμ² μ λνλ¨ |
μ€ν νμ΄λ° | λ²μ μ μ€νλ¨ | μμ² μ μ€νλ¨ |
κ°μ μ΄λ¦μ λ³μ μ¬μ© | λΆκ°λ₯ | κ°λ₯ |
μ±λ₯ | λΉ λ¦ | λΉκ΅μ λλ¦Ό |
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
μ½λκ° νμνλ€.π https://www.sitesbay.com/jsp/include-directive-and-include-action
π https://way2java.com/jsp/difference-between-jsp-include-directive-and-include-action