Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSTL Caching, query string dependent

843840Nov 26 2007 — edited Nov 27 2007
Hi, every page of my site has to pull in some html from another (ASP) site for the navigation. Unfortunately I am limited to using JSP/JSTL to do this.

I am using a <c:import> tag along with some code to cache the result of the import, which seems to be working fine.

What I can't figure out how to do is to store a separate cache of the navigation for each page (as a different nav item will be selected/expanded depending on where you are in the site).

This is the code so far - but what I'd like to do is replace "applicationScope.x" with "applicationScope.${param.selectedid}" (which obviously, isn't valid JSTL).

Does anyone have any ideas?

<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>

<c:set var="cachePeriod" value="${100000}" />
<jsp:useBean id="n" class="java.util.Date" />
<c:if test="${(n.time - cacheTime) > cachePeriod}">
remove
	<c:remove var="x" scope="application" />
</c:if>
<c:if test="${empty applicationScope.x}">
new
	<c:set var="x" scope="application" >
		<c:import url="http://navigationurl">
            <c:param name="selectedid" value="${param.selectedid}" />
        </c:import>
    </c:set> 
    <jsp:useBean id="now" class="java.util.Date" />
    <c:set var="cacheTime" value="${now.time}" scope="application" />
</c:if>
<c:out value="${applicationScope.x}" escapeXml="false" />
<c:out value="${param.selectedid}" escapeXml="false" />
     
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 25 2007
Added on Nov 26 2007
5 comments
349 views