aspose file tools*
The moose likes JSP and the fly likes paging help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "paging help" Watch "paging help" New topic
Author

paging help

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I have 100 records and I display 10 per page. So I get 10 links on my page.
What I want to do is display 5 links and a next button. When the user clicks on the 5th link it should display the next 5 links.

For eg (looks like this now)
1 2 3 4 5 6 7 8 9 10


I need like
1 2 3 4 5 next>>

if I click on 1 2 3 4 link it should display the same as above.. Only
if clicked on 5th link i need to display

<<prev 6 7 8 9 10 next>>

below is the for loop I tried but I am not getting the desired effect.

if(currpage!=0)
out.println("<a href = 'empCases.jsp?page="+ (page1-1) + "'>" + "[prev]" + "</a>");

for (int i= currpage, j=0 ;(i<numPages && j< 5 ); j++,i++){
out.println("<a href = 'empCases.jsp?page="+ i + "'>" + (i + 1) + "</a>");

if(currpage<(numPages-1))
out.println("<a href = 'empCases.jsp?page="+ (page1+1) + "'>" + "[Next]" + "</a>");
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30938
    
158

Shan,
What are you getting?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
 
subject: paging help