κ²μν λ©μΈ νλ©΄
μμ μμ
1.
web.xml - <welcome-file-list> νκ·Έ μμ±
2.
index.jsp νμ΄μ§ μμ±
3.
μ½λ μμ±
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" id="WebApp_ID" version="4.0">
<display-name>Board</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.jsp</welcome-file>
<welcome-file>default.htm</welcome-file>
</welcome-file-list>
</web-app>
HTML
볡μ¬
<welcome-file-list>
<welcome-file>μ΄κΈ° νμΌλͺ
</welcome-file>
</welcome-file-list>
μ€λͺ
ν΄λΌμ΄μΈνΈκ° μΉ μ ν리μΌμ΄μ
λ£¨νΈ URLμ μ κ·Όν λ μλμΌλ‘ νμλλ μ΄κΈ° νμ΄μ§λ₯Ό μ μνλ λ° μ¬μ©λ©λλ€.
μ¬κΈ°μ μΉ νμ΄μ§ μ΄κΈ° νλ©΄μ μ€μ νμκΈ° λλ¬Έμ, μλ²μ λ£¨νΈ κ²½λ‘μ μ κ·Όνμ λ index.jsp λ₯Ό λ³Ό μ μμ΅λλ€.
index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html data-bs-theme="light">
<head>
<meta charset="UTF-8">
<jsp:include page="/layout/main/import/meta.jsp" />
<jsp:include page="/layout/main/import/link.jsp" />
</head>
<body>
<jsp:include page="/layout/main/UI/header.jsp" />
<div class="container">
<div class="px-4 pt-5 my-5 text-center border-bottom">
<h1 class="display-4 fw-bold">κ²μν νλ‘μ νΈ</h1>
<div class="col-lg-6 mx-auto">
<p class="lead mb-4">JSP κ²μν νλ‘μ νΈ μ
λλ€.</p>
<div class="d-grid gap-2 d-sm-flex justify-content-sm-center mb-5">
<button type="button" class="btn btn-primary btn-lg px-4 me-sm-3">κ²μκΈ
λͺ©λ‘</button>
<button type="button" class="btn btn-outline-secondary btn-lg px-4">λ‘κ·ΈμΈ</button>
</div>
</div>
<div class="overflow-hidden">
<div class="container px-5">
<img src="https://i.imgur.com/pPxobUQ.jpg" class="img-fluid border rounded-3 shadow-lg mb-4" alt="κ²μν νλ‘μ νΈ" width="700" height="500" loading="lazy">
</div>
</div>
</div>
</div>
<jsp:include page="/layout/main/UI/footer.jsp" />
<jsp:include page="/layout/main/import/script.jsp" />
</body>
</html>
HTML
볡μ¬
code
<jsp:include page="νμΌλͺ
.jsp" />
HTML
볡μ¬
μ€λͺ
<jsp:include> λ JSP μ‘μ
νκ·Έλ‘ μΈλΆ JSP νμ΄μ§ νμΌμ ν΄λΉ νμΌμ ν¬ν¨μν€λ νκ·Έμ
λλ€.
μ¬κΈ°μλ, meta.jsp, link.jsp, header.jsp, footer.jsp, script.jsp λ₯Ό ν¬ν¨μν€κ³ μμ΅λλ€. μ΄λ κ² ν¨μΌλ‘μ¨ λ μλ‘μ΄ νλ©΄μ κ°λ°ν λ, λ§€λ² κ³΅ν΅μ μΌλ‘ μ°μ΄λ μμμ νκ·Έλ₯Ό μ€λ³΅ νμ¬ μμ±νμ§ μμλ λ©λλ€. λν, ν€λ μμ μμ μ, λ€μμ μ€λ³΅λ μ½λλ₯Ό λ²κ±°λ‘κ² μμ νμ§ μμλ header.jsp νμΌ νλλ§ μμ νλ©΄ λκΈ° λλ¬Έμ μ μ§λ³΄μνκΈ° μ½κ³ μμ°μ±μ΄ λμμ§λλ€. μ΄λ¬ν μμ
μ ν
νλ¦Ώ μμ
μ΄λΌκ³ λΆλ¦
λλ€.
λ©μΈνλ©΄μ μμ±νμμ΅λλ€. μ΄μ κ²μν νλ‘μ νΈμ μ£Όμ κΈ°λ₯λ€μ νλμ© κ°λ°ν΄ λκ°λ³΄λλ‘ νκ² μ΅λλ€.