title: how to show error message when session time out glassfish security?
body: <p>I am using Glassfish security with Realm for my J2ee project using jsf . My session time out in 30 min.</p>
  
  <p>when i click on component  it is redirecting to the login page thats good.</p>
  
  <p>but u want before that the user click on the component when the session is out a dialog or msg need to apear to alarm user that the session is expired .</p>
  
  <p>thats why i tried this way but didnt work using jsf listener :</p>
  
  <pre><code>&lt;f:event listener="#{Logincontroller.checksessiontimeout}" type="preRenderView"/&gt;
  </code></pre>
  
  <p>and in the managed been :</p>
  
  <pre><code>public void checksessiontimeout(ComponentSystemEvent event) 
      {
          FacesContext context = FacesContext.getCurrentInstance();
          HttpServletRequest request = (HttpServletRequest)             context.getExternalContext().getRequest();
          if (request.getRequestedSessionId()!=null &amp;&amp; !request.isRequestedSessionIdValid())
          { 
              System.out.println("Session Log OUT");
          }
      }
  </code></pre>
  
  <p>but when the session is time out didnt print nothing for me thats prove the function didnt work .</p>