aspose file tools*
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
JavaRanch » Java Forums » Java » Java in General
Bookmark "Pagination using java" Watch "Pagination using java" New topic
Author

Pagination using java

rakesh parida
Greenhorn

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.

Rakesh.
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: 9622
    
    2

Have a look at the Value List Handler design pattern http://java.sun.com/blueprints/patterns/ValueListHandler.html


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
Rancher

Joined: Oct 14, 2008
Posts: 1337
Also see http://faq.javaranch.com/java/PaginationOrPaging
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pagination using java