File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Pagination using java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Pagination using java" Watch "Pagination using java" New topic

Pagination using java

rakesh parida

Joined: May 13, 2010
Posts: 6

Hi All,

I have to present a demo of doing pagination of a list and i do not want to use any frame work like display tag. I want to use core java for this, since this will be a very simple demo on pagination.

If any one had done similar thing before, please share the approach/steps to do that.

Any tutorial on net would also be fine.

Peter Taucher
Ranch Hand

Joined: Nov 18, 2006
Posts: 174
I'm not providing any code for your 'very simple demo'. I used filterable ListModel implementations in the past. They had two collections of elements:
1) All elements (unfiltered)
2) Filtered elements (subset)
The model then works only with the filtered subset and provides a method applyFilter(...).

To use a similar approach for paging, you could remember the page index (and page size) and create your subset in a method like setPage(...). I see no big obstacles here.

Censorship is the younger of two shameful sisters, the older one bears the name inquisition.
-- Johann Nepomuk Nestroy
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10033

Have a look at the Value List Handler design pattern

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Lester Burnham

Joined: Oct 14, 2008
Posts: 1337
Also see
I agree. Here's the link:
subject: Pagination using java
It's not a secret anymore!