tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart Maclean <>
Subject Re: Quick question/Off topic
Date Tue, 12 Sep 2000 19:45:56 GMT

   Sorry if this is slightly off topic and I know its been covered before but
   I've seen it done different ways, in jsp

   how are you guys making sure your dynamic pages get reloaded (! not cached
   by the browser) and are you using the meta tag or a response header.  Any
   code snippets?

   thanks.. cause the way i'm doing it now doesnt work


I brought this up a while back.  Your query is the opposite of mine,
but I found a solution to the non-cacheability of JSP, in terms of not
setting Last-Modified header.

JSP doesn't support the servlet notion of 'getLastModified' call
during the 'service' method.  So I built a technique whereby you map
the URL to a servlet, not a JSP, at say foo.jsp.  The servlet does
whatever if needs to do to ascertain the lastmodified time, maybe just
get (and save!) current time.  In doGet(), it uses the RequestDispatcher to
include the 'wrapped' JSP page foo.wjsp.  You have to map *.wjsp to the
Jsp servlet, but thats easy.  I think its a nice, general, technique.

You can build a base JspWrapper servlet class which does the
including, say from foo.jsp -> foo.wjsp, a simple string manipulation,
and then subclass this class for specific scenarios of
'getLastModified'.  I used this when a JSP page was built from data in
a db which didn't change once formatted.  Not only do you not go back
to the db, you don't even send the HTML more than once (to a client
which provides an If-Modified-Since header of course).

I can provide code if anyone wants a further look...


Stuart Maclean, Research Associate
University of Washington
ITS Research Program, College of Engineering
Box 352500
Seattle, WA 98195-2500
Tel: (206) 543-0637

View raw message