title: How to detect session has been invalidated in JSF 2?
body: <p>In my application I have a quit button, on clicking of which the session for the current user is invalidated by the following piece of the code..</p>
  
  <pre><code>FacesContext.getCurrentInstance().getExternalContext().invalidateSession();
  </code></pre>
  
  <p>And I redirect the user to a different page.</p>
  
  <p>But now I want if user click on the back button I will take him to the start page of the application instead of the last page visted by him.
  I have an application phase listener which sets the page cache related headers to 'none', now all I want is to detect that for that user session has been invalidated.
  But I guess whenever the user is clicking the back button it is creating a new session for the user. Is there any way to prevent it? </p>