August 9th, 2002, 01:58 PM
JSP Design question
I have to develop a website, where in i have to show a table with data,
I want to show only 10 records per page, I got a taglib on www.jsptags.com for paging logic which works fine,
I have a bean which calls a store procedure, and this bean has page scope
so each time when i load the page, it calls the store proceudre , then this taglib get the resultset and load 10 records,
when the user clicks on next page link, again the page is loaded and all results extracted and the pages shows next 10.
so each time i change the page the store procedure is executed.
Is there a way i can run the store procedure only once and save the resultset and use it for next displays.
I think one way is to keep the resultset in session and before calling the storeprocedure, check in session , if there is resultset dont call or else call the store procedure.
Does anyone have a better way of doing it
August 10th, 2002, 02:28 PM
Sounds like a fine way of doing it.
August 12th, 2002, 03:05 PM
If you put the ResultSet in session it stays connected to the database. Result sets are populated as you ask for each row so it keeps the connection open. You can use a CachedRowSet or loop through the ResultSet and store all the data in a Javabean as a Collection like an ArrayList and put that where your pages use it.
August 12th, 2002, 06:23 PM
August 12th, 2002, 11:01 PM
Thanx for the replies , right now i am using cahced rowset to store the data and use to load the jsp pages, and when ever the user reloads the page, reload the data...
about cached rowset u can get info at
also has anyone developed any logic,if there are say 1 million records in database and need to be displayed 10 at a time.
also has anyone return a stateless bean ..i hope it may help in this condition...