>>> Gokul Singh <[EMAIL PROTECTED]> 17-Aug-00 5:42:01 AM >>>
>I think this is a nice way to solve the problem when
>the same client is viewing the same page more than
>once.
That's why it's in the API /8->
>I have a doubt. Let us consider the scenario when a
>page, generated dynamically, is viewed by more than
>one client. The servlet knows when the HTML changes.
>I do not want to generate the HTML page each time a
>request for it is received. Can i someway cache them so
>that I generate them only when the page has changed
>otherwise serve the already generated page.
Of course you can.
Your servlet just needs to ensure that it knows when the page must be
updated.
Let's say you can ask a database when the data has changed... in that
case the important bit of your servlet would look like this:
public long getLM(Http... request)
{
ResultSet rs=database.query("select change-data from sometable");
return rs.getLongColumn(1);
}
All you have to do is ensure that you've got some way of finding out
when the resource changes... as long as you can do that you can use
this system.
In your example your getLM() method must be the bit that "knows" when
the HTML needs to be changed.
Or rather it needs to know when the HTML did change.
If you don't know when the resource changed you can of course simply
return a more recent date than is in the "if-modified-since" header -
it'll work just the same.
Nic
___________________________________________________________________________
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