网上找到的例子回来测试一下
<div class="table-pagination"> <ul class="pagination"> <li th:class="${contactsPage.number eq 0} ? 'disabled' : ''"> <a th:if="${not contactsPage.firstPage}" th:href="@{${'/contacts'}(page=${contactsPage.number-1},size=${contactsPage.size})}">Previous</a> <a th:if="${contactsPage.firstPage}" href="javascript:void(0);">Previous</a> </li> <li th:each="pageNo : ${#numbers.sequence(0, contactsPage.totalPages - 1)}" th:class="${contactsPage.number eq pageNo}? 'active' : ''"> <a th:if="${contactsPage.number eq pageNo}" href="javascript:void(0);"> <span th:text="${pageNo + 1}"></span> </a> <a th:if="${not (contactsPage.number eq pageNo)}" th:href="@{${'/contacts'}(page=${pageNo},size=${contactsPage.size})}"> <span th:text="${pageNo + 1}"></span> </a> </li> <li th:class="${contactsPage.number + 1 ge contactsPage.totalPages} ? 'disabled' : ''"> <a th:if="${not contactsPage.lastPage}" th:href="@{${'/contacts'}(page=${contactsPage.number+1},size=${contactsPage.size})}">Next</a> <a th:if="${contactsPage.lastPage}" href="javascript:void(0);">Next</a> </li> </ul> </div>