• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Pagination using java

 
Greenhorn
Posts: 6
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at the Value List Handler design pattern http://java.sun.com/blueprints/patterns/ValueListHandler.html
 
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also see http://faq.javaranch.com/java/PaginationOrPaging
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic