Hi Pawan,
Here is one of the solutions for your problem :
Lets assume that you have a query which looks like this
-String SQL = "select fieldnames from tablename where condition";
You want to display only 10 records every request. You also dont want to
store the data in session because the data may be huge. So you should be
running the query given below to retrieve only 10 records per request.
-String Stmt="SELECT * FROM "
+"( SELECT ROWNUM RNUM,TMP.* FROM ("+SQL+") TMP where rownum <=
"+(rowStart_+rowsToLoad_)+")"
+" WHERE RNUM>"+rowStart_;
Here rowsToLoad_ = 10;
rowStart should be calculated by you from the page number requested by the
user (eg rowStart = pageNumber*10);
Note - 1) The above query is written for Oracle.
2) Make sure the fieldnames used in the queries are indexed to ensure
faster execution.
The database has to be queried every request because you dont want to store
the data in session. But dont worry about the performance. This query works
pretty fast if you index the tables properly.
The site www.redladder.com uses this query for displaying results. Go to
this site and click on 'View Public Directory' on leftbar (bottom-most
image). This should give you an approx. execution time for the above query.
Kishore Raghavan
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Aggarwal, Pawan
Sent: Friday, June 09, 2000 4:38 AM
To: [EMAIL PROTECTED]
Subject: Re: Urgent:Displaying 10 records in one page
I got a suggestion that I should place the Hashtable containing the records
from the query in the session
Now there is a problem
There is a form which contains combo boxes selection upon which query is
based..
The results are based on the fields selected by the user..
Suppose a single user comes to this form..
Opens a NEW WINDOW simultaneously...now here no new session is created..I
have checked this..
In one window he provides different parameters and in the other different...
Now in the session hashtable variable name is same and also session id
So the values will be overwritten by the other...
The user wants different result in different windows however he will get
same...
How do people like altavista and google do it??
Please advice as this is a major issue..
-----Original Message-----
From: Aggarwal, Pawan [SMTP:[EMAIL PROTECTED]]
Sent: 09 June 2000 12:06
To: [EMAIL PROTECTED]
Subject: Urgent:Displaying 10 records in one page
Hi,
I am using a servlet to display 10 out of nth records got from the
database..
The servlet is using a helper class to get Hashtable..
Now the same servlet will be called to display to another 10
records...
How do I store the Hashtable so that the next time it reads the
servlet
It displays next 10 records.
I think storing hashtable in Session will not be adviceable..
If someone has a piece of code will be of great help!!
Thanks
===========================================================================
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
===========================================================================
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
===========================================================================
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