Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Browser cacheing a page  RSS feed

Benson Liu
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm new to JSF and am having a problem.

I have two JSPs. The first, docMain.jsp, uses the h:commandLink target="_blank" to popup a new browser window to another JSP, docView.jsp.

In docMain.jsp I pass some parameters on the h:commandLink

<h:commandLink... target="_blank">
<f aram name="contentKey" value="#{Bean.contentKey}" />

in the docView.jsp, I attempt to prevent the JSP from being cached

response.setHeader("pragma", "no-cache");
response.setHeader("Cache-control", "no-cache, no-store, must-revalidate");
response.setHeader("Expires", "01 Apr 1995 01:10:10 GMT");

// then look for the content in the session using the request parameter
String contentKey = (String)request.getParameter("contentKey");
byte[] bytes = (byte[])session.getAttribute(contentKey);


The above works fine in most cases except when the user does not close the existing child pop-up window. If he clicks on another link in the docMain.jsp (it's a list of documents in a DataTable component), the content from the previous link is displayed again.

My best guess is that the browser has cached the contents of the previous link. Since the URL does not change, it re-displays the cached page.

How do I fix this? redirect will not work since I rely upon the request parameter for the content key.

Is there a way to ask JSF to give me a unique URL or to append the content key to the URL?

Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!