|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Hi,
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 URL 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 Ashish |
|
#2
|
|||
|
|||
|
Sounds like a fine way of doing it.
|
|
#3
|
|||
|
|||
|
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.
|
|
#4
|
|||
|
|||
|
Yup, I just read that about resultsets. Better to make a databean to store the info.
I have never heard of a CachedRowSet. Where did you see this? EDIT: nm, I found it http://www.javaworld.com/javaworld/...-cachedrow.html |
|
#5
|
|||
|
|||
|
Hi,
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 URL 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... Ashish |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > JSP Design question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|