Hi Chris, Thank you very much. It worked just fine.
Thanks Vinaya -----Original Message----- From: Christian Poecher [mailto:[EMAIL PROTECTED] Sent: Thursday, November 20, 2008 11:07 AM To: [email protected] Subject: Re: Facelets Back Button Vinaya Tirikkovalluru wrote: > > Hi, > > > > I recently switched over to facelets. > > Now all my jsps are xhtmls > > How do I expire the page if the user clicks on browser back button? > > > > Any ideas? > Hi Vinaya, I just did it via a Phase Listener. This would work on all JSF implementations. The problem is though that due to a bug Firefox 3.0.x ignore the cache settings. I saw that they consider it a major bug and they also have a patch read with the last modified date of yesterday. Here is the code: import javax.faces.context.FacesContext; import javax.faces.event.PhaseEvent; import javax.faces.event.PhaseId; import javax.faces.event.PhaseListener; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; public class NoBrowserCachePhaseListener implements PhaseListener { public void afterPhase(PhaseEvent event) { // Do nothing special } public void beforePhase(PhaseEvent event) { FacesContext facesContext = event.getFacesContext(); HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse(); response.addHeader("Pragma", "no-cache"); response.addHeader("Cache-Control", "no-cache"); response.addHeader("Cache-Control", "no-store"); response.addHeader("Cache-Control", "must-revalidate"); response.addHeader("Expires", "0"); } public PhaseId getPhaseId() { return PhaseId.RENDER_RESPONSE; } } You need to add this to your faces-config.xml: <lifecycle> <phase-listener>NoBrowserCachePhaseListener</phase-listener> </lifecycle> HTH, Chris -- View this message in context: http://www.nabble.com/Facelets-Back-Button-tp20582987p20604555.html Sent from the MyFaces - Users mailing list archive at Nabble.com. This electronic message is intended only for the use of the individual(s) or entity(ies) named above and may contain information which is privileged and/or confidential. If you are not the intended recipient, be aware that any disclosure, copying, distribution, dissemination or use of the contents of this message is prohibited. If you received this message in error, please notify the sender immediately.

