Hi,

A question : is there any specific application requirement
to display the ResultSet as more than one HTML page ? Because,
if not, you could just send all the data as one single page,
and let the user scroll through the page using the browser's
scroll bars.

If there is a specific need for multiple pages, see below.

Pages created on the fly  by the servlet are not stored
anywhere, they're just sent to the browser. If you want
to re-display a previously sent page, you'll have to store
it's contents in some data structure in your servlet, such
as a Vector of Strings, where each String holds one page
of the generated HTML. With this approach, of course,
memory could be become a constraint if you have a
large number of pages. Another option is to write each
generated page to a separate file on the server, and read
it back in when requested and resend it. For this you will
have to maintain some sort of mapping between some
page identifier (such as the page number, which you generate
whie sending the page) and the file name on disk.
A third approach could be to save all generated pages
in a single file, and save the byte offset and the length
in bytes of each page, in an array, and then use a
RandomAccessFile to seek to the start of the requested
page and read the right number of bytes, and return
them to the browser.  You could also enhance
the two file-based options by keeping recently
accessed pages in memory, and when a page is
requested, look for the page in the in-memory
cache first, and only read it from the disk if
it's not in the cache. This would improve performance
if there are some pages more frequently requested
than others.

These are just some quick ideas, there may be better
ways. You could also post more details of what you
want to do to get better answers.

HTH

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Vasudev Ram
Infosys Technologies Limited
Pune, India
Email : [EMAIL PROTECTED]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
On a clear day you can see the blue screen of death.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>












~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

--------------------------------------------------------------------------
========================================================


> -----Original Message-----
> From: Yuki Tanabe [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, November 26, 1999 7:53 PM
> To:   [EMAIL PROTECTED]
> Subject:      Returning pages that span multiple pages
>
> I want to write a servlet whose number of html pages generated depend on
> the
> size of a ResultSet. Ideally the servlet will generate a html page with a
> pointer to the next page and/or previous page. What I don't understand is
> where
> are the pages created on the fly by the servlet stored? Could someone
> point me
> to a suitable reference manual or give me some explanation?
>
> T.A.
>
> Yuki
>
>
>
> ______________________________________________________________________
> This E.Mail is confidential and intended for its addressee only. If you
> have
> received this in error, please delete it from your PC and inform us by
> telephone.
>
> No reliance may be placed upon this E.Mail without written confirmation of
> its
> contents and any liability arising from such reliance without written
> confirmation is hereby excluded. Copyright in this E.Mail remains with the
> Sumitomo Bank Limited
>
> __________________________________________________________________________
> _
> 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