본문 바로가기

콩's EDUCATION/콩's JSP&SERVLET

jsp:include 이용하여 레이아웃(layout) 실습

jsp:include를 사용하여 페이지 레이아웃을 실습!

 

layout.jsp

 

<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"">
<title>Layout.jsp</title>
</head>
<body>
<table width="400" border="1" cellpadding="0" cellspacing="0">
<tr><td colspan="2">
<jsp:include page="top.jsp" flush="false"></jsp:include>
</td></tr>
<tr><td width="100", valign="top">
<jsp:include page="left.jsp" flush="false"></jsp:include>
</td>
<td width="300" valign="top">
<!--  내용부분 :시작 -->

<center>
<p>메인입니다.</p>
</center>

<!--  내용부분 :끝 -->
</td>
</tr>
<tr>
<td colspan ="2">
<jsp:include page="bottom.jsp" flush="false"></jsp:include>
</td>
</tr>
</table>
</body>
</html>

 

top.jsp

 

<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<p>
위쪽입니다
</p>

 

left.jsp

 

<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<p>
왼쪽입니다
</p>

 

bottom.jsp

 

<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<p>
아래입니다
</p>

 

결과