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" />