728x90
products.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="bookVO.BookVO"%>
<%@ page import="java.util.List"%>
<%@ page import="bookDAO.BookReposutory"%>
<%
BookReposutory bookDAO = BookReposutory.getInstance();
List<BookVO> books = bookDAO.getAllProducts();
%>
<c:set var="books" value="<%=books%>"></c:set>
<!DOCTYPE html>
<html>
<head>
<title>Insert title here</title>
</head>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<body>
<%@ include file="menu.jsp" %>
<div class="jumbotron">
<div class="container">
<h1 class="display-3">
도서 목록
</h1>
</div>
</div>
<div style="width: 60%; margin: 0px auto;">
<c:forEach var="book" items="${books}" varStatus="stat">
<table style="margin: 0px auto; width: 100%;">
<tr>
<th><h3>[${book.category}] ${book.name}</h3></th>
</tr>
<tr>
<td>${book.description}<br><br></td>
<td rowspan="2" style="position: relative;"><a style="position: absolute; top: 0px;" href="product.jsp?id=${book.bookId}" class="btn btn-secondary">상세 정보»</a></td>
</tr>
<tr>
<td>${book.author} | ${book.publisher} | ${book.unitPrice}<br></td>
</tr>
</table>
<hr>
</c:forEach>
</div>
<footer class="container">
<p>©BookMarket</p>
</footer>
</body>
</html>
product
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="bookVO.BookVO"%>
<%@ page import="java.util.List"%>
<%@ page import="bookDAO.BookReposutory"%>
<%
BookReposutory bookDAO = BookReposutory.getInstance();
String id = request.getParameter("id");
BookVO book = bookDAO.getBookById(id);
%>
<c:set var="book" value="<%=book%>"></c:set>
<!DOCTYPE html>
<html>
<head>
<title>Insert title here</title>
</head>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<body>
<%@ include file="menu.jsp" %>
<div class="jumbotron">
<div class="container">
<h1 class="display-3">
도서 정보
</h1>
</div>
</div>
<div style="width: 60%; margin: 0px auto;">
<table style="margin: 0px auto; width: 100%;">
<tr>
<th><h3>[${book.category}] ${book.name}</h3></th>
</tr>
<tr>
<td>${book.description}</td>
</tr>
<tr>
<td>도서코드 : <span class="badge badge-danger">${book.bookId}</span></td>
</tr>
<tr>
<td>출판사 : ${book.publisher}</td>
</tr>
<tr>
<td>저자 : ${book.author}</td>
</tr>
<tr>
<td>재고수 : ${book.unitsInStock}</td>
</tr>
<tr>
<td>총 페이지 수 : ${book.totalPages}</td>
</tr>
<tr>
<td>출판일 : ${book.releseDate}</td>
</tr>
<tr>
<td><h3>${book.unitPrice}</h3></td>
</tr>
<tr>
<td>
<a href="#" class="btn btn-secondary">도서주문»</a>
<a href="/products.jsp" class="btn btn-danger">도서목록»</a>
</td>
</tr>
</table>
<hr>
</div>
<footer class="container">
<p>©BookMarket</p>
</footer>
</body>
</html>
'JSP > 웹페이지 만들기' 카테고리의 다른 글
JSP 웹페이지 만들기 8장 연습문제 (0) | 2023.07.15 |
---|---|
JSP 웹페이지 만들기 7장 연습문제 (0) | 2023.07.05 |
JSP 20230703 웹페이지만들기 6장 form정리 및 실습 (0) | 2023.07.03 |
JSP 4장 액션 태그 + 자바빈즈 정리 + 연습문제 (1) | 2023.06.27 |
JSP 3장 디렉티브 태그 정리 + 연습문제 (0) | 2023.06.27 |