반응형
Notice
Recent Posts
Recent Comments
Link
«   2025/09   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
Tags
more
Archives
Today
Total
관리 메뉴

비전공개미 개발노트

[JSP] jsp:include를 이용해서 페이지 불러오기 본문

프로그래밍/JSP

[JSP] jsp:include를 이용해서 페이지 불러오기

비전공개미 2022. 10. 12. 19:22
반응형
SMALL

top.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
TOP 메뉴 -
<a href="index.jsp?target=home">홈</a>
<a href="index.jsp?target=champ">챔피언정조</a>
<a href="index.jsp?target=tech">공략</a>
</body>
</html>

 

 

menu.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<table>
  <tr><td>MENU</td></tr>
  <tr><td><a href="#">자료실</a></td></tr>
  <tr><td><a href="#">아이템정보</a></td></tr>
  <tr><td><a href="#">자유게시판</a></td></tr>
</table>
</body>
</html>

 

 

bottom.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
BOTTOM 부가 내용 -
<a href="#">회사소개</a> |
<a href="#">찾아오는길</a>
</body>
</html>

 

 

index.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
	td { padding: 1em;}
</style>
</head>
<body>
<table border="1">
  <tr>
    <td colspan="2">
      <jsp:include page="module/top.jsp" flush="false" />
    </td>
  </tr>
  <tr>
    <td valign="top">
      <jsp:include page="module/left.jsp" flush="false" />
    </td>
    <td>
      레이아웃1<br><br>
    </td>
  </tr>
  <tr>
    <td colspan="2">
      <jsp:include page="module/bottom.jsp" flush="false" />
    </td>
  </tr>
</table>
</body>
</html>

 

 

페이지 include하는 방법

1. <%@ inlucde file="index.jsp" %>

2. <jsp:include page="index.jsp" flush="false" />

반응형
LIST
Comments