<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="<http://java.sun.com/jsp/jstl/core>" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>imageboardListResult.jsp</title>
<style type="text/css">
table, tr, td {
border: 1px solid black;
border-collapse: collapse;
}
td {
text-align: center;
}
#paging-block {
width: 1000px;
text-align: center;
}
#paging{
color: black;
text-decoration: none;
}
#currentPaging {
color: red;
text-decoration: underline;
}
</style>
</head>
<body>
<br><br>
<h2>상품 목록</h2>
<br>
<table>
<tr>
<th width="50px">번호</th>
<th width="90px">이미지</th>
<th width="200px">상품명</th>
<th width="120px">가격</th>
<th width="120px">수량</th>
<th width="120px">합계</th>
</tr>
<c:forEach var="dto" items="${list }">
<tr>
<td>${dto.seq }</td>
<td>
<a href="imageboardView.jsp?seq=${dto.seq }&pg=${pg}"><img src="../storage/${dto.imageFile }" width="80px" height="80px"/></a>
</td>
<td>${dto.imageName }</td>
<td>${dto.imagePrice }</td>
<td>${dto.imageQty }</td>
<td>${dto.imagePrice * dto.imageQty }</td>
</tr>
</c:forEach>
</table>
<br><br>
<!-- 페이징 -->
<div id="paging-block">
<c:if test="${startPage > block }">
[<a href="imageboardList.jsp?pg=${startPage -1 }" id="paging">이전</a>]
</c:if>
<c:forEach var="i" begin="${startPage }" end="${endPage }" step="1">
<c:if test="${i == pg }">
[<a href="imageboardList.jsp?pg=${i}" id="currentPaging">${i}</a>]
</c:if>
<c:if test="${i != pg }">
[<a href="imageboardList.jsp?pg=${i}" id="paging">${i}</a>]
</c:if>
</c:forEach>
<c:if test="${endPage < totalPage }"> <%-- endPage가 총 페이지보다 작을 때 --%>
[<a href="imageboardList.jsp?pg=${endPage +1 }" id="paging">다음</a>]
</c:if>
</div>
<br><br>
<input type="button" value="main" onclick="location.href='../main/index.jsp'" style="display: flex; justify-content: center;"/>
</body>
</html>