Cache Taglib
| Newsgroups | gmane.comp.jakarta.taglibs.user |
|---|---|
| Message-ID | <OF205729E3.A037EC69-ON85257125.005307E6-85257125.00577D9B@dancik.com> |
I'm trying to use the cache taglib, and either I'm not doing something
right, or the docs aren't telling me everything I need to do.
Here's the test page I'm trying to cache and then print the cached HTML to
System.out:
<%@ taglib uri="http://jakarta.apache.org/taglibs/cache-1.0"
prefix="cache" %>
<cache:cache name="myBody" scope="page">
<%@include file="test.jspf"%>
</cache:cache>
<%
System.out.println((String) pageContext.getAttribute("myBody"));
%>
I'm running Tomcat 4.1.29. I have the taglibs-cache.tld in my apps
WEB-INF folder, and the taglibs-cache.jar in my WEB-INF/lib folder. I
also added the following to my WEB-INF/web.xml:
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/cache-1.0</taglib-uri>
<taglib-location>/WEB-INF/taglibs-cache.tld</taglib-location>
</taglib>
(Note: FYI - the documentation has an error - it says to use:
<taglib-location>/WEB-INF/cache.tld</taglib-location>, when it should be:
<taglib-location>/WEB-INF/taglibs-cache.tld</taglib-location>.)
When I access this page, I get the normal HTML output generated by the
test.jspf sent to the browser, but I get "null" sent to System.out.
Is there something I'm not getting, not doing right, or is it not working?
Or is it that I can't access the cached output in the same page?
Any help is greatly appreciated!
Thanks,
Johnny