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

ResultSet Paging Help

david andre king
Greenhorn

Joined: Jun 24, 2002
Posts: 4
I have a datasource with a list of information and need to implement a paging function, where for example, instead of showing all 1000 results, I want to display 25 or 50 per page..
I am considering using the Page-By-Page Iterator, but is there a way to do the same thing without using this pattern?
Thanks
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
hhmm... I'm not too familiar with the Page-By-Page Iterator design pattern... but one idea that comes to my mind is to put the results in a vector and now you have control over the number of elements you want to display in every page. You can also control the >>next and <<back link.
it's only a suggestion... it's probably the same as page-by-page
cheers


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

This question has been covered nicely in the Servlet, JSP and JDBC forums. I would recoomend a search in those forums first.
The short answer is that there are several possible solutions and the specific one you go with depends on your what you are doing.
Dave
lakshmi rajagopal
Greenhorn

Joined: Jun 22, 2002
Posts: 5
pass a parameter called page numer to the jsp page which is going to display result set.Restrict the no.of records per page like 25.now go to the record 25 * pagenumber and start to display upto 25 records. Put two buttons as previouse<< and next>> . In on click event handler of the previous button reduce the page number and call the same page. In on click event handler of the next button increase the page number and call the same page.


lakshmi
L Goundalkar
Ranch Hand

Joined: Jul 05, 2001
Posts: 395
Originally posted by lakshmi rajagopal:
pass a parameter called page numer to the jsp page which is going to display result set.Restrict the no.of records per page like 25.now go to the record 25 * pagenumber and start to display upto 25 records. Put two buttons as previouse<< and next>> . In on click event handler of the previous button reduce the page number and call the same page. In on click event handler of the next button increase the page number and call the same page.


Where will you have th ResultSet onject. ?
In Session??
Since you are passing the request to same JSP page. naturally you will not Query the database everytime.
Do you have any idea of using RowSet or CachedRowSet instead of this.
Thanks.


SCJP, SCWCD
david andre king
Greenhorn

Joined: Jun 24, 2002
Posts: 4
Thanx for all the suggestions, I have a copy
of a good JSP book by Duane Field that refers to
a CachedRowSet Impl.
I want to retrieve a list of articles and populate an ArrayList or Vector.. (i made it that far), I just need to figure out the displaying of records.
For ex. if I have 100 records, I want to display
1-25, 26-50 ,etc..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ResultSet Paging Help