Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dump the result set into a List of objects ?

843836May 7 2005 — edited May 9 2005
How to do this:

A) Dump the result set into a List of objects that hold the data from the results, and store the List in the session. Then when you reload/view next/previous page, you can take a sublist from the list...

int start = page * itemsPerPage;
int end = start + itemsPerPage;
List sublist = mylist.sublist(start, end);


B) If the database supports LIMIT (and most do), then you can get the database to return the page of data only. So just get a connection and make a new query for the page.

int start = page * itemsPerPage;
ResultSet rs = stmt.executeQuery("select * from myTable limit " + start + ", " + itemsPerPage);

B) no beans or tags just jsp <%=jspcode %>

C) My goal: 5 records per page and navigation Previous���| 1 - 2 - 3 - 4 - 5 |���Next

Mail to or reply post: ckhan83@hotmail.com
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 6 2005
Added on May 7 2005
8 comments
504 views