Karan,

If your data is ORDERED then it is easy and you DO NOT have to cache the
data.

For example:
You want to display a list of products alphabetically (25 at a time).

SQL is like: select * from product
Loop thru the results for 25 rows and send the list to the browser.
After you 25th row, store the last_productname in the session.

User hits the 'next 25' button.

SQL is like: select * from product
Now our last_productname is NOT NULL so we append to the SQL:
" where productname > '"+last_productname+"'"

Code is like:
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
int iPerPageCount = 25; // could be anything
String strSQL = "select * from product";
String last_productname = session.get("last_productname");

if (last_productname != null)
{
    strSQL += "'" + last_productname + "'";
}

ResultSet rs = statement.executeQuery(strSQL);

while(rs.next() && i != iPerPageCount)
{
    /// BUILD HTML FOR EACH ROW
    last_productname = rs.getString("productname");
}

if (rs.next())
    {
    session.put("last_productname", last_productname);
    /// PUT A 'NEXT 25' button on page
    }
else
    session.remove("last_productname");

/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
AGAIN, I SAY, this will only work if the data is ordered.

Lee

>From: Karanjit Singh <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
>     reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: interesting one, 200 concurent users, large resultstes
>Date: Thu, 3 Aug 2000 17:57:00 GMT
>
>Dear members,
>Can anyone plz let me know that if i have to display 50,000
>records at the client using JSP, where can i cash those records, if i keep
>all the records at the server in some array or scrollable cursor then my
>server will come to its knees when i get more then 200 concurnet hits(which
>iam expecting). If anyone has got any idea plz let me know. Do anyone knows
>what major search engines r doin, while
>displaying the results of searches which generate large resultsets. They r
>sending all the information to the client side, requering the database
>everytime the user hits next or they r not stateless and maintain the data
>at the servers(which i think whould really bring the server to knees)
>      If anyone knows plz shed some light & help me.
>      Thx in advance.
>      Karan
>
>________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>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

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
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