You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tim Kientzle <ki...@acm.org> on 2000/07/17 05:55:52 UTC

JSP and Caching

I'm currently designing a system which will involve some fairly
involved back-end page building, which in turn is going to require
some very flexible front-end caching to improve performance.  (In
particular, some parts of the page _must_ be generated fresh
for every serve, even though most of the constructed page can be
cached.)

I had planned to do all of the page-building using Java servlets
and building my own caching code (possibly leveraging parts of Turbine).
However, after reading some of the discussions about JSP-based
designs, I'm considering a mix of JSP and servlets.

Question:  What facilities or techniques are there for caching
partially-built JSP pages?

For example, is there any way for <jsp:include...> to cache
the included piece so as to avoid generating it anew each time?

Alternatively, is there an easy way for a servlet to capture the
output of a JSP page so that it can cache and/or post-process
the resulting HTML?

On a related note, is there a way to pull the text of a JSP page
from a database table rather than from the filesystem?

Is there a way for a servlet to feed the text of a JSP page
into the JSP processor?  (To support dynamically-generated
JSP pages, for example.)

I suspect that JSP isn't really going to work for this project,
but I thought it was worth examining.

			- Tim

P.S. An observation:  There's a lot of discussion here about
"Virtual hosting" and servlets.  When discussing this, please
keep in mind that there are two distinctly different
environments:  One where each virtually hosted web site is
completely independent and you want to sandbox separate groups
of servlets, and another where the servlets are providing common
infrastructure for all web sites.  The latter environment requires
that you be able to share a single instance of each servlet across
many web sites, so that each servlet can perform efficient
caching across different sites.  (Of course, both environments
require that servlets can discover which web site they're
running under, which may require not just a site name but
also a "document root directory" that is appropriate for
the site, not just the particular web-app.  The concerns
of distributed systems shouldn't cripple the capabilities
of non-distributed systems.)