Skip to content

Instantly share code, notes, and snippets.

@sadv1r
Created March 12, 2016 22:35
Show Gist options
  • Save sadv1r/e1e5f19cb6a544d8fc48 to your computer and use it in GitHub Desktop.
Save sadv1r/e1e5f19cb6a544d8fc48 to your computer and use it in GitHub Desktop.
<div class="dataTables_paginate paging_bootstrap pagination">
<ul>
<li class="<c:if test="${currentPage == 1}">disabled</c:if>">
<a href="<c:if test="${currentPage != 1}"><spring:url value="/history/1"/></c:if>"
<c:if test="${currentPage == 1}">onclick="return false;"</c:if>>First</a>
</li>
<li class="prev<c:if test="${currentPage == 1}"> disabled</c:if>">
<a href="<c:if test="${currentPage != 1}"><spring:url value="/history/"/>${currentPage - 1}</c:if>"
<c:if test="${currentPage == 1}">onclick="return false;"</c:if>> ← </a>
</li>
<c:choose>
<c:when test="${currentPage == 1}">
<li class="active"><a href="#">${currentPage}</a></li>
<li><a href="<spring:url value="/history/${currentPage + 1}"/>">${currentPage + 1}</a></li>
<li><a href="<spring:url value="/history/${currentPage + 2}"/>">${currentPage + 2}</a></li>
<li><a href="<spring:url value="/history/${currentPage + 3}"/>">${currentPage + 3}</a></li>
<li><a href="<spring:url value="/history/${currentPage + 4}"/>">${currentPage + 4}</a></li>
</c:when>
<c:when test="${currentPage == 2}">
<li><a href="<spring:url value="/history/${currentPage - 1}"/>">${currentPage - 1}</a></li>
<li class="active"><a href="#">${currentPage}</a></li>
<li><a href="<spring:url value="/history/${currentPage + 1}"/>">${currentPage + 1}</a></li>
<li><a href="<spring:url value="/history/${currentPage + 2}"/>">${currentPage + 2}</a></li>
<li><a href="<spring:url value="/history/${currentPage + 3}"/>">${currentPage + 3}</a></li>
</c:when>
<c:when test="${currentPage > 2 && currentPage <= lastPage - 2}">
<li><a href="<spring:url value="/history/${currentPage - 2}"/>">${currentPage - 2}</a></li>
<li><a href="<spring:url value="/history/${currentPage - 1}"/>">${currentPage - 1}</a></li>
<li class="active"><a href="#">${currentPage}</a></li>
<li><a href="<spring:url value="/history/${currentPage + 1}"/>">${currentPage + 1}</a></li>
<li><a href="<spring:url value="/history/${currentPage + 2}"/>">${currentPage + 2}</a></li>
</c:when>
<c:when test="${currentPage == lastPage - 1}">
<li><a href="<spring:url value="/history/${currentPage - 3}"/>">${currentPage - 3}</a></li>
<li><a href="<spring:url value="/history/${currentPage - 2}"/>">${currentPage - 2}</a></li>
<li><a href="<spring:url value="/history/${currentPage - 1}"/>">${currentPage - 1}</a></li>
<li class="active"><a href="#">${currentPage}</a></li>
<li><a href="<spring:url value="/history/${currentPage + 1}"/>">${currentPage + 1}</a></li>
</c:when>
<c:when test="${currentPage >= lastPage}">
<li><a href="<spring:url value="/history/${currentPage - 4}"/>">${currentPage - 4}</a></li>
<li><a href="<spring:url value="/history/${currentPage - 3}"/>">${currentPage - 3}</a></li>
<li><a href="<spring:url value="/history/${currentPage - 2}"/>">${currentPage - 2}</a></li>
<li><a href="<spring:url value="/history/${currentPage - 1}"/>">${currentPage - 1}</a></li>
<li class="active"><a href="#">${currentPage}</a></li>
</c:when>
</c:choose>
<li class="next<c:if test="${currentPage >= lastPage}"> disabled</c:if>">
<a href="<c:if test="${currentPage < lastPage}"><spring:url value="/history/"/>${currentPage + 1}</c:if>"
<c:if test="${currentPage >= lastPage}">onclick="return false;"</c:if>> → </a>
</li>
<li class="<c:if test="${currentPage >= lastPage}">disabled</c:if>">
<a href="<c:if test="${currentPage < lastPage}"><spring:url value="/history/"/>${lastPage}</c:if>"
<c:if test="${currentPage >= lastPage}">onclick="return false;"</c:if>>Last</a>
</li>
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment