You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Vinaya Tirikkovalluru <vi...@converge.com> on 2008/12/04 22:08:07 UTC

RE: Facelets Back Button

Hi,

This worked for me with facelets.
I have another application with out Facelets.
I have the following code on the jsp.

<%
	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");
%>

This works for some jsps and is not working for otheres

Any ideas??

Thanks
Vinaya

-----Original Message-----
From: Christian Poecher [mailto:christian.poecher@mailinator.com] 
Sent: Thursday, November 20, 2008 11:07 AM
To: users@myfaces.apache.org
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.

Facelets is slow???

Posted by Vinaya Tirikkovalluru <vi...@converge.com>.
Hi,

I just switched over to facelets.
I see the pages load really slow.
I used templates. I see that the Menu is loading way faster than the
other part of the page.

I have JSF+ SPRING + JBOSS + TOMOHAWK

Any ideas?
Thanks




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.

RE: Facelets Back Button

Posted by Christian Poecher <ch...@mailinator.com>.


Vinaya Tirikkovalluru wrote:
> 
> <%
> 	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");
> %>
> 
> This works for some jsps and is not working for otheres
> 
> Any ideas??
> 
> 

Hi Vinaya,

I don't know why you are having these problems, but I would suggest you look
into the HTTP Headers of the problematic requests. You could use TCPMon or
FireBug.

HTH,
Chris
-- 
View this message in context: http://www.nabble.com/Facelets-Back-Button-tp20582987p20896139.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.