Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes Pagging Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Pagging Problem" Watch "Pagging Problem" New topic
Author

Pagging Problem

Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 732
Hello,



The above code output is correct until the page no 5 but when the page goes to 6 then its adding like 1 2 3 4 5 6 and on clicking 7 it showing again from start like: 1 2 3 4 5

Kindly help me to fix this problem

Best regards
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7552
    
  18

Farakh khan wrote:The above code output is correct until the page no 5 but when the page goes to 6 then its adding like 1 2 3 4 5 6 and on clicking 7 it showing again from start like: 1 2 3 4 5

I'm afraid your code lost me at 'noOfPagesPerPage'. I also don't see anything to do with "clicking".

Perhaps it would be easier if you explain what it is you're trying to do.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

If you don't want the numbers to always start at 1, then do something about line 32 in your post which says "Start at 1".
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 732
Winston Gutkowski wrote:
Perhaps it would be easier if you explain what it is you're trying to do.
Winston

Thanks for your reply

I have huge amount of data in my Oracle table to display. I am trying to display some records per page basis. This piece of code fulfil my requirements but not working properly. start, end,next, previous, first and last page working fine but I am trying to display 5 page numbers per page. Its also working for first time but when the page becomes 6 then its adding 6 number in previous page nos. On display of 7 page it display again 1-5 page nos instead of 6-10 pages to go a head

Thanks again
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7552
    
  18

Farakh khan wrote:I have huge amount of data in my Oracle table to display. I am trying to display some records per page basis.

OK, with you so far.

This piece of code fulfil my requirements but not working properly. start, end,next, previous, first and last page working fine but I am trying to display 5 page numbers per page.

And this is where you lose me. What do you mean by 'displaying 5 page numbers per page'? It's either a page or it isn't, surely? Why not just display the current page number?
Assuming you're numbering your records from 1, that would simply be:
1 + ([current start record - 1] / number of records per page) (which looks like it's 5 in your case)

But maybe I'm missing something somewhere.

Winston

Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 732
Paul Clapham wrote:If you don't want the numbers to always start at 1, then do something about line 32 in your post which says "Start at 1".


I tried many ways but I am so silly to not understand. Can you please get me any clue?

Best regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pagging Problem
 
Similar Threads
NumberFormatException: For input string: "null"
Pagging Problem
java.lang.IllegalStateException
Want to convert my code in method
getter and setters