How to add next and previous buttons to my pager row

Posted by eddy on Stack Overflow See other posts from Stack Overflow or by eddy
Published on 2011-02-05T16:42:21Z Indexed on 2011/02/07 23:25 UTC
Read the original article Hit count: 248

Filed under:
|

Hi folks!!

How would I add next/previous buttons to this snippet, cause as you can see ,it will display as many links as it needs, so if you have a high number of pages then this might not be the best solution

 <c:choose>
   <c:when test="${pages >1}">
        <div class="pagination art-hiddenfield" >
             <c:forEach var="i" begin="1"end="${pages}" step="1">
                  <c:url value="MaintenanceListVehicles.htm" var="url">
                      <c:param name="current" value="${i}"/>                
                  </c:url>
                  <c:if test="${i==current}">
                       <a href="<c:out value="${url}"/> " class="current" >
                           <c:out value="${i}" /></a>
                  </c:if>
                  <c:if test="${i!=current}">
                       <a href="<c:out value="${url}"/> " >
                           <c:out value="${i}" /></a>
                  </c:if>
              </c:forEach>
         </div>
    </c:when>
    <c:otherwise>
       <div align="center">                   
       </div>
    </c:otherwise>
</c:choose>

CSS:

.pagination .current {
    background: #26B;
    border: 1px solid #226EAD;
    color: white;
}
.pagination a {
    display: block;
    border: 1px solid #226EAD;
    color: #15B;
    text-decoration: none;
    float: left;
    margin-bottom: 5px;
    margin-right: 5px;
    padding: 0.3em 0.5em;
}
.pagination {
    font-size: 80%;
    float: right;
}
div {
    display: block;
}

This is what I get with my current code: enter image description here And this is what I'd like to display, with ellipsis if possible enter image description here

Hope you can help me out.

© Stack Overflow or respective owner

Related posts about jsp

Related posts about jstl