aspose file tools*
The moose likes JSP and the fly likes page pagination Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "page pagination" Watch "page pagination" New topic
Author

page pagination

david allen
Ranch Hand

Joined: Sep 27, 2002
Posts: 185
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
Devesh H Rao
Ranch Hand

Joined: Feb 09, 2002
Posts: 687

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

Joined: Sep 27, 2002
Posts: 185
thank you for your reply
david
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: page pagination
 
Similar Threads
Pagewise Results
Dynamic next/previous link
Page-wise display in JSPs
displaying records in different pages.
how to achieve pagination on jsp