If we knew how many row's made one "page", and we knew what page the user
was on, would it be possible to format the SQL query so that it would return
the correct records?

In other words, is there a SQL primitive for specifying row #, or a range of
rows?

> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Erik
> Hanson
> Sent: Tuesday, July 20, 1999 6:57 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Servlets
>
>
> Jigar S. Shah [I] <[EMAIL PROTECTED]> wrote:
> >we would like to give an option to ther user to restrict his search
> >results to a particular number and provide a button to go the next
> >results as we have in common search engines
> >
> >I am not sure how this can be done using servlets, I do not want to
> >make a new connection to the database each time user clicks "Next
> >results", How can i store the resultset from database and get the next
> >results.
>
>
> Get all the data and save it to a local cache file or store it with the
> user's session. Then build the first page and return it. When the
> user wants
> to see the second page, use the data from the cache file or from
> the user's
> session to build the second page.
>
> To make things easier, you could write a class that reads a text file and
> returns a ResultSet object. I have done such a thing. It's pretty easy. If
> you want to have a look at my code, let me know. That way, my database
> accessors always read from a ResultSet. Sometimes the data is from the
> database, other times it's from the local cache file, but my database
> accessing code doesn't know (or care).
>
> The drawback of such a system is that if the user only gets one
> pageful and
> then goes away, you have just wasted a lot of time getting all
> the rows from
> the database and saving them to a cache file. As a tradeoff, you could
> always get five (or so) pages-worth of data and save them to the
> cache file,
> and then go back to the database if the user wants more. Or only get one
> page-worth the first time and if the user asks for the second
> page, get the
> next 10 (or so) pages-worth.
>
>
> Erik
>
> __________________________________________________________________
> _________
> To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to