DataTable caches when called from HTML link in another frame

Hey all,

We're having the following problem: our system isframe based, one frame is the menu, and the other the data page. Everything works wonders when we're working within the data page frame, even when moving between different pages being called through the navigation system. But when we call a page from the menu (which is stored in an html page), it loads a cached version, usually theFIRST version of the page (and DataTable) that was loaded by the user.

No matter how many refreshes on the browser, frame and DataTable we do, whenever we click on the menu to go to that page again, it displays the cached version. We even added a Refresh Table button to force a refresh of the DataTable and go back to the actual data (it calls the refresh method in the DataTable's DataProvider) and temporarily solve this problem.

I'd also like to note we tried using the metadata to clear the cache, but to no use. Here's what we put in our <ui:head>:

<ui:meta content="no-cache"httpEquiv="Pragma" />

<ui:meta content="no-cache"httpEquiv="Cache-Control" />

<ui:meta content="no-store"httpEquiv="Cache-Control" />

<ui:meta content="max-age=0"httpEquiv="Cache-Control" />

<ui:meta content="1"httpEquiv="Expires" />

I'd like to stress that after the refresh the DataTableDOESshow the correct results, but when you open the page from the menu again, it'll revert to the cached version, requiringanotherrefresh to update it.

Anyone got any ideas? Could this be a cache of the java code compiled from the JSP? What can we do to solve this? Note that making the menu a JSPX page or using page fragments isNOTan option right now as we're in too tight a schedule to go playing with that now (the menu already existed in previous versions and we're keeping it like it is for development speed and compatibility sakes).

Thanks in advance for any help,

Heliton

[2259 byte] By [helitonfilho] at [2007-11-26 10:37:50]
# 1

I find the following tutorial very helpful

http://www.mnot.net/cache_docs/

An excerpt:

Meta tags are easy to use, but aren抰 very effective. That抯 because they抮e only honored by a few browser caches (which actually read the HTML), not proxy caches (which almost never read the HTML in the document). While it may be tempting to put a Pragma: no-cache meta tag into a Web page, it won抰 necessarily cause it to be kept fresh.

I hope that this tutorial provides information that helps you to solve your problem.

Chris

jetsons at 2007-7-7 2:48:58 > top of Java-index,Development Tools,Java Tools...
# 2

Chris,

Thanks for the tutorial. Very elucidating.

But my problem remains, since I don't know how to set HTTP headers in JSF/Creator. I'd already considered using them, but couldn't find out how to do it anywhere, thus having to try the HTML headers.

Is there another tutorial or reference you could kindly point me to showing how to set them under Creator?

Thanks,

Heliton

helitonfilho at 2007-7-7 2:48:58 > top of Java-index,Development Tools,Java Tools...
# 3
See this forum thread http://forum.sun.com/jive/thread.jspa?threadID=64951&messageID=243055For tutorials about JSF and JSP, see http://java.sun.com/products/jsp/docs.htmlHope this helps,Chris http://blogs.sun.com/divas
jetsons at 2007-7-7 2:48:58 > top of Java-index,Development Tools,Java Tools...
# 4

Chris,

Thanks for the pointers. This code did the trick:

<ui:head id="head1">

<jsp:scriptlet>

response.addHeader("Pragma","no-cache");

response.setHeader("Cache-Control","no-cache, no-store, must-revalidate");

response.addHeader("Cache-Control","pre-check=0, post-check=0");

response.setDateHeader("Expires", 0);

</jsp:scriptlet>

</ui:head>

Thanks a lot :)

helitonfilho at 2007-7-7 2:48:58 > top of Java-index,Development Tools,Java Tools...