• 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

Spliting records per page

 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys

I am trying to handle 100 of records and want to split them into pages (so only 50 records per page with back/forward links). Im not entirely sure how I should code this. I was thinking of placing all records into a list and then simply use get to call the records. What do you guys think?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See the JSP FAQ entry on paging.
 
shaf maff
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, a good read. But how should code it whilst storing the data in a session ? I am thinking of getting all the records and storing them into a session and then paginating, but that isn't efficient as the servlet might need to load 1000s of records so it would be better to load only the records the user requests.. So an alternative method is checking the session for the requested records, then the DB(if request data not found in session). Does that sound like a good solution?

[ September 29, 2008: Message edited by: shaf maff ]
[ September 29, 2008: Message edited by: shaf maff ]
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to balance memory load with DB access, caching is a good idea. Just be sure that it's fairly configurable so that you can easily adjust it to suit the conditions.
reply
    Bookmark Topic Watch Topic
  • New Topic