my pagination works well, but I can't figure out how to create a fixed number of page links. For example, I need to have 5 fixed links this way: 1 - 2 - 3 - 4 - 5> if I click on the third page, I will always see 5 links: <3 - 4 - 5 - 6 - 7>
Now with my algorithm, I can only generate all the links, but I have no idea how to create what I explained above. This is my code (only for href generation):
<div class="pageBoxRight"> <c:if test="${param.pageNumber > 1}"> <a href="javascript: previousRecords();" class="previous"><em>previous</em></a> </c:if> <c:forEach var="i" begin="1" end="${tot + 1}" step="1" varStatus ="status"> <a href="javascript: goToPage(${i});" id="paginator${i}" class="pageNumber"><span class="pageNumberRight">${i}</span></a> </c:forEach> <c:if test="${param.pageNumber < tot}"> <a href="javascript: nextRecords();" class="next"><em>next</em></a> </c:if> </div>
Can someone help me? Thank you very much.
carlo source share