jump to navigation

Caching using WebLogic tags July 19, 2007

Posted by Phill in Application Servers, Presentation Layer.
Tags: , ,
comments closed

We’ve been having a random issue with JSP fragments recently: on one of our applications, the page layout components are divided into JSP fragments. Each JSP fragment pulls in the actual content from a page on our client’s server (so they can easily update it). It works like this:

The main page includes a component, say, leftnav.jsp: <jsp:include page="leftnav.jsp" />

leftnav.jsp looks a bit like this:

<wl:cache timeout="15m" async="true">
<io:http url="http://url/page.html" action="GET" />

The problem we’ve been having is that sometimes, the body content appears in the left-hand navigation bar, and the left-hand navigation gets displayed twice! I think we’ve basically narrowed it down to the caching. According to WebLogic’s documentation, the cache JSP tag by default uses the page URI as the cache key. If you have multiple cache elements in a page (which the leftnav.jsp does have) I think this could cause a problem.

What we have done so far is give each cache tag element a distinct name, and the problem hasn’t occured again … yet! It’s difficult to track down because it’s quite erratic.

Hopefully that will solve the problem — if not, I will have to update again soon 😉