I want to clear the cache in JSF i tried the following code but still the problem is not solved.
FacesContext facesContext = event.getFacesContext();
HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
response.setHeader("Expires","Mon, 8 Aug 2006 10:00:00 GMT"); // some date in the past
i write the above code in PhaseListener#beforePhase. still it's not worling
The woods are lovely, dark and deep, But I have promises to keep; And miles to go before I sleep, And miles to go before I sleep. - Robert Frost
The setHeader() overrides any previously set header on the same name. You need addHeader() when you want to add header values for the same header name. You can also set the header values commaseparated using only one setHeader().
After all, you just need cache-control="no-cache" for this. All the other cache-control settings are superfluous when the "no-cache" is set. Here's the complete and correct set:
Don't forget to clear the browser cache before testing.