3 Replies Latest reply on Jul 24, 2012 10:23 AM by atarifreak73

    Session Expiration Handling

    atarifreak73 Newbie

      Hello,

       

      I have a problem with handling for session timeouts by ajax.

      I have readed chapter 5.6. "Error handling" and have put the following entries in my web.xml to use A4J in Javascript:

       

       

          <context-param>
              <param-name>org.ajax4jsf.handleViewExpiredOnClient</param-name>
              <param-value>true</param-value>
          </context-param>
      

       

      It dont works. Then I have write additional this to web.xml:

       

          <context-param>
              <param-name>org.richfaces.LoadScriptStrategy</param-name>
              <param-value>ALL</param-value>
          </context-param>
      
      

       

      It dont also works. When I use the A4J-Object (A4J.AJAX.onExpired) in Javascript for errormessaging, I become from firebug the message "ReferenceError: A4J is not defined":

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE html
              PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
              "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
            xml:lang="en" lang="en"
            xmlns:a4j="http://richfaces.org/a4j"
            xmlns:ui="http://java.sun.com/jsf/facelets">
          <ui:composition>
              <script type="text/javascript">
                  A4J.AJAX.onExpired = function(loc, expiredMsg)
                  {
                      if (window.confirm("Ihre Sitzung abgelaufen: Beim Klick auf OK wird eine neue Sitzung gestartet!"))
                      {
                          return '#{facesContext.externalContext.requestContextPath}/index.html';
                      }
                      else
                      {
                          return false;
                      }
                  };
              </script>
          </ui:composition>
      </html>
      
      

       

      I use RF 4.2 and JSF 2.0.9.

       

      What is my error in reasoning?

      Thank You!