954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help in generating fixed number of link in pagination

Hi, my pagination works good but I'm not able to understand how generate a fixed number of links to the pages.
For example, I need to have 5 fixed links in this way: 1 - 2 - 3 - 4 - 5 >
if I click on the third page I will see always 5 links: < 3 - 4 - 5 - 6 -7 >

Now with my algorithm I'm only able to generate all the links, but I have no idea how create what I have 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? Thanks a lot.

Carlog
Newbie Poster
1 post since Dec 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: