자바과정/JSP
JSP 실습 Template
Parkej
2021. 3. 10. 15:30
// template.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
<%
String item = request.getParameter("name")+".jsp";
if(request.getParameter("name") == null){
item = "newitem.jsp";
}
%>
<table border="1" >
<tr>
<td colspan="2">
<jsp:include page="top.jsp"/>
</td>
</tr>
<tr>
<td>
<jsp:include page="left.jsp"/>
</td>
<td>
<jsp:include page="<%=item %>"/>
</td>
</tr>
<tr>
<td colspan="2">
<jsp:include page="bottom.jsp"/>
</td>
</tr>
</table>
</body>
</html>
// left.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<%
request.setCharacterEncoding("euc-kr");
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
<div align = "center">
<a href="?name=newitem">신상품</a>
<br><br>
<a href="?name=bestitem">인기상품</a>
</div>
</body>
</html>
// top.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
<a href="">Login</a> | <a href="">Join</a>
</body>
</html>
// bottom.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
<div align = "center">
Since 2021
</div>
</body>
</html>
// newitem.jps / bestitem.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
<div align="center">
<b>신상품 목록입니다</b>
</div>
</body>
</html>
/////////////////////////////////////////////////////////////////////////////////////////////
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
<div align="center">
<b>인기상품 목록입니다</b>
</div>
</body>
</html>
반응형