-
1. Re: Problem of "Back button"or pages caching in "Mozilla Fir
dragan.mi Dec 10, 2008 8:06 AM (in response to dragan.mi)I have a intranet application with JSF 1.2, Richfaces 3.2.0, Facelets, Hibernate 3.2.6, Java 1.5 Update 11 and a Tomcat 6.0.16 application server. It works very well and I am very satisfied with Richfaces. By using <a4j:keepAlive/> tag the application works in many tabs simultaneously!
But there is a problem of "Back button" or pages caching . I know that it is a question for Java Server Faces but ...
I add a PhaseListener:
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;
public class CacheControlPhaseListener implements PhaseListener {
private static final long serialVersionUID = 1L;
public PhaseId getPhaseId(){
return PhaseId.RENDER_RESPONSE;
}
public void afterPhase(PhaseEvent event) {}
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", "must-revalidate");
response.addHeader("Expires", "Mon, 8 Aug 2006 10:00:00 GMT"); // some date in the past
}
}
After that in Internet Explorer 7 if I click "Back Button" or select a page from cache I get the page "Page has expired ". That's fine. But, in Mozilla Firefox 3 there are't any changes! If I want to disable pages caching I must enter the url about:config and set properties browser.cache.disc.enable and browser.cache.memory.enable to false. After that there aren't pages caching and there aren't any problems! But, I want to disable pages caching without client browser's setup.
Can I solve this problem without Seam or Spring Web Flow?! -
2. Re: Problem of "Back button"or pages caching in "Mozilla Fir
dragan.mi Dec 10, 2008 8:07 AM (in response to dragan.mi)I have a intranet application with JSF 1.2, Richfaces 3.2.0, Facelets, Hibernate 3.2.6, Java 1.5 Update 11 and a Tomcat 6.0.16 application server. It works very well and I am very satisfied with Richfaces. By using <a4j:keepAlive/> tag the application works in many tabs simultaneously!
But there is a problem of "Back button" or pages caching . I know that it is a question for Java Server Faces but ...
I add a PhaseListener:
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;
public class CacheControlPhaseListener implements PhaseListener {
private static final long serialVersionUID = 1L;
public PhaseId getPhaseId(){
return PhaseId.RENDER_RESPONSE;
}
public void afterPhase(PhaseEvent event) {}
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", "must-revalidate");
response.addHeader("Expires", "Mon, 8 Aug 2006 10:00:00 GMT"); // some date in the past
}
}
After that in Internet Explorer 7 if I click "Back Button" or select a page from cache I get the page "Page has expired ". That's fine. But, in Mozilla Firefox 3 there are't any changes! If I want to disable pages caching I must enter the url about:config and set properties browser.cache.disc.enable and browser.cache.memory.enable to false. After that there aren't pages caching and there aren't any problems! But, I want to disable pages caching without client browser's setup.
Can I solve this problem without Seam or Spring Web Flow?!