Woa! If you use a bean at session scope to store the whole resultset, what
happens if the site has 100's of users each returning 1000's of rows? You
talking about TB of memory for the server..or with paging a MAJOR slowdown
of the site.

The way to do it is to set up the database for caching of results, or use
EJB and allow the container to cache results as needed. Session state should
be maintained for forms, and the state of a users "wizard" entries across
forms, data that needs to be displayed, etc. When dealing with large
resultsets, you need to keep going back to the database. This is usually why
a database cluster has HUGE powerful machines, such as Sun E450 servers
loaded to the max with RAM and a nice veritas HD cluster or something. I am
no expert on the use of databases, caching, etc..but storing an entire
result set in a session object ties it to that one user..and each user can
do this! Your going to have problems with memory very quickly unless you
have TONS of front-end web servers. I believe databases can cache results
effeciently, and if not, you can probably use multiple queries to select the
results from the table. Worse case..just "cache" the ID's of each row in the
order it appears (use an ArrayList over a Vector if you are storing it as a
HttpSession object since each session has its own reference..there is no
worry about another session accessing it at the same time, nor should there
be any worry about two or more threads from various requests because it is
damn near impossible for one user to submit via the same window two or more
times in rapid fashion.


> -----Original Message-----
> From: Costas Simatos [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 31, 2001 1:13 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Split the ResultSet Values
> 
> 
> Hi,
> 
> Use a bean, with session scope, to retrieve the data from the 
> database.
> Store the result set in a Vector. This should be done the 
> first time the
> page is loaded. Your bean will have two functions, one that returns a
> specific range (min to max) of the result set stored in the 
> Vector, and
> another one that checks if there are more results in the 
> Vector. Clicking on
> next or previous (your buttons on your page) you will reload 
> the page with
> min and max incremented by e.g. 10 or deincremented by 10 
> respectively. You
> will know when the page is loaded for the first time because 
> the request
> parameters min and max will be null. In this case the min and 
> max will be
> initialized with 0 and 9 (for 10 records at a time).
> 
> You should probably be able to follow this approach easily.
> 
> Costas
> 
> -----Original Message-----
> From: Prakasan OK [mailto:[EMAIL PROTECTED]]
> Sent: Ôñßôç, 31 Éïõëßïõ 2001 9:28 ðì
> To: [EMAIL PROTECTED]
> Subject: Split the ResultSet Values
> 
> 
> Hi All,
>      I want to split the resultset values into different parts.
> I want to display the 10 results first and if the user clicks next
> button
> i would like to display the next 10 results  and so on similar
> to the search results in Google. Any idea about how this can be done
> using JSP?
> 
> Thanks in Advance,
> Prakasan
> 
> ==============================================================
> =============
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
> 
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> 
> ==============================================================
> ============To unsubscribe: mailto [EMAIL PROTECTED] with 
> body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set 
> JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
> 
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> 

==========================================================================To 
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to