File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes paging in servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "paging in servlets" Watch "paging in servlets" New topic

paging in servlets

Anthony Karta
Ranch Hand

Joined: Aug 09, 2004
Posts: 342
I'm in the middle of implementing Catalog Page - following Marty Hall book -well the sample codes only use static Array.

My catalog data is in table.

is it good idea to load all records in catalog object (ArrayList)? they are around 100 at the moment and growing.

is there another/better approach? could someone show me how to implement paging (say 20 item per page) in Servlets or should handle by JSP? how? is there any online sample/resources?

thanks all

Rahul Juneja
Ranch Hand

Joined: Aug 03, 2002
Posts: 425

There is a datastructure called Cached Rowset in Java which can be used to get the data in a tabular form in one call to the database and then u can read the data records 10 rows at a time from that. This is also called disconnected rowset as it doesn't fires a connection every time next set of records are fetched.

I think this can be the suitable option for you if your data doesn't get updated every time.

Rahul Juneja

Rahul Juneja
ThoughtClicks -
Anthony Karta
Ranch Hand

Joined: Aug 09, 2004
Posts: 342
Thanks Rahul! I didn't realize Java has Cached Rowset. But how to implement it...

do I need to create Cached Rowset for every session? or put it in init() method in Servlet or import the data class in JSP page?

if Rowset is disconnected then how I can check the stock of items?

do you have some sample codes or somewhere on internet?

thanks again
I agree. Here's the link:
subject: paging in servlets
Similar Threads
Paging in Struts
how to Autosave the changes when the page is changed?
recordset in different pages
how to use paging with jsp
implement paging in jsp