• 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

page pagination

 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have created a class that retrieves data from the db and displays 20 records per page.At the bottom of the page will be a series of links that will provide access to the same page but with a paramter that will determine where in the recordeset should it begin to display the records ie there are 20 per page.
link 1 = 20
link 2 = 40
link 3 = 60
I have it working but i am sure that there is a better way of doing it. Does anyone know about a good tutorial.
Regards David
 
Ranch Hand
Posts: 687
Hibernate jQuery Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by david allen:
I have created a class that retrieves data from the db and displays 20 records per page.At the bottom of the page will be a series of links that will provide access to the same page but with a paramter that will determine where in the recordeset should it begin to display the records ie there are 20 per page.
link 1 = 20
link 2 = 40
link 3 = 60
I have it working but i am sure that there is a better way of doing it. Does anyone know about a good tutorial.
Regards David


I have no idea how u are implementing the display of the paging and where u are storing the data retrived from the search results.
we had faced a similar situation in our project where the option's were
1> storing the data in the session which u fetch the first time u search and then use it as the feeder for subsequent hits.
pros: U fetch the data once and reuse it, the database hits are reduced and network traffic between appserver and database is reduced.
cons: the session becomes very heavy if the result retrived becomes large.
2> fetch the data from the database always while retriving only the rows that are to be shown based on rownum. here also there were two options where the data was searched according to the rownum in the database or the whole set was searched and only the required rows were used the rest discarded.
pros:session remains relatively light and the query part takes care of all the logic.
cons atabase gets stressed.

3> Throw the whole data to the frontend where javascript arrays will store it and all the paging will be done in the clientside.
pros:clientside takes care of everything hence server remains relatively stress free.
cons:if u have tried javascript coding u wont ask why this is a con.. (atleast when i tried it i was stuck bad.)
The approach we followed.
if the results thrown was within a certain limit the session took care of it or else we followed the second approach where we relied on the database to drive the querying.
 
david allen
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you for your reply
david
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic