This content has been marked as final.
Show 4 replies
-
1. Re: Disabling browser cache ???
pmuir Oct 11, 2007 8:08 AM (in response to terryb)Probably your best bet is to use a filter which adds a header to the response object.
-
2. Re: Disabling browser cache ???
terryb Oct 11, 2007 9:44 PM (in response to terryb)
Thanks. I tried following? it executs but it gets invoked many time for each page. I think once or so for every included xhtml, since my page has template, headers, footer, menu bars in seperate files. I guess that is normal...public class NoCachePhaseListener implements PhaseListener { public PhaseId getPhaseId() { return PhaseId.RENDER_RESPONSE; } public void afterPhase(PhaseEvent phaseEvent) { } public void beforePhase(PhaseEvent phaseEvent) { FacesContext facesContext = phaseEvent.getFacesContext(); HttpServletResponse response = (HttpServletResponse)facesContext.getExternalContext().getResponse(); try{ response.setHeader("Cache-Control", "no-cache, must-revalidate"); response.setDateHeader("Expires", 0L); response.setHeader("Pragma", "No-cache"); }catch(NullPointerException npe){ System.out.println("Null http response, no action on cache-control"); } } }
faces-config.xml:<lifecycle> <phase-listener>au.edu.tisc.util.NoCachePhaseListener</phase-listener> </lifecycle>
-
3. Re: Disabling browser cache ???
lisaanm Oct 12, 2007 3:55 AM (in response to terryb)"terryb" wrote:
Anyone knows how to set response header in Seam/JSF to stop browser cache?
I have a problem which is turing out to be a pain. Say I have a JSF page to view a record, then I delete it. But everytime I bring up view page, it still shows the record, even though its been deleted from the database.
I believe this to be a common problem, yet I can't find any solution.
I use default RHDS set up with JBoss AS 4.2.0.
I think its not with browser cache but with your view rendering. Check whether your action method outcome returns no 'null', instead return empty string "", then the page would be rendered new. -
4. Re: Disabling browser cache ???
terryb Oct 13, 2007 4:54 AM (in response to terryb)Thanks Lisa, yes my action was not returning empty string.