● 게시판 LIST 페이지 넘버링 처리 - list.html
페이지 정보
본문
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{include/layout.html}">
<body>
<div layout:fragment="content">
<br>
<center>
<h1>게시판</h1>
<table width=700 border=0>
<tr>
<td>Total : <span th:text="${pm.totalCount}"></span></td>
<td></td>
</tr>
</table>
<!-- 부모 태그에 전역변수 처리 -->
<table width=700 border=1 th:with="nums=${pm.totalCount - (pm.cri.page - 1) * pm.cri.perPageNum}">
<tr height=30>
<td width="5%" align=center>No</td>
<td width="*">제목</td>
<td width="8%">조회수</td>
<td width="20%">작성일</td>
</tr>
<tr th:if="${#lists.size(list)} > 0" th:each="v, num :${list}"><!-- tr 태그가 반복 -->
<!-- 지역변수 -->
<td th:text="${nums - num.index}" align=center></td>
<td>
<a th:href="@{view(boardIdx=${v.boardIdx})}" th:text="${v.title}"></a>
</td>
<td th:text="${v.hitCnt}"></td>
<td th:text="${#temporals.format(v.createdDatetime,'yyyy-MM-dd HH:mm:ss')}"></td> <!-- ② -->
</tr>
<tr th:if="${#lists.size(list)} == 0 ">
<td colspan=4 align=center height=50>게시글이 없습니다.</td>
</tr>
</table>
<!-- 페이징 시작 -->
<table width=700 border=0>
<tr>
<td align=center>
<!-- 이전 링크 -->
<span th:if="${pm.prev}">
<a href="list"th:attrappend="href=${pm.makeQuery(pm.startPage - 1)}">«</a>
</span>
<!-- 페이지 -->
<span th:with="start=${pm.startPage} , last=${pm.endPage}">
<span th:each="page: ${#numbers.sequence(start,last)}">
<a th:text="${page}" href="list"th:attrappend="href=${pm.makeQuery(page)}"></a>
</span>
</span>
<!-- 다음 링크 -->
<span th:if="${pm.next && pm.endPage > 0}">
<a href="list"th:attrappend="href=${pm.makeQuery(pm.endPage + 1)}">»</a>
</span>
</td>
</td>
</table>
<!-- 페이징 끝 -->
<table width=700 border=0>
<tr>
<td></td>
<td align=right><a href="write">[글쓰기]</a></td>
</tr>
</table>
</center>
<br>
</div>
</body>
</html>
- 이전글view.html 24.06.10
- 다음글● 게시판 PAGING 처리 24.06.10
댓글목록
등록된 댓글이 없습니다.