5 Replies Latest reply on Mar 24, 2010 9:14 AM by Agustin Sivoplás Ferrari

    A4J.AJAX.onExpired not work

    Agustin Sivoplás Ferrari Expert

      I'm trying to use this code for controling session expiration, but i can't make to work. Im use JSF 1.2 and Richfaces 3.3.2

       

      I put in the page.xhtml

       

       

      <script type="text/javascript">
      A4J.AJAX.onExpired = function(loc,expiredMsg){
      alert("Hey dude, the session expired");
      };
      </script>
      

       

      My web.xml

       

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee  http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      
      <!-- Use Documents Saved as *.xhtml -->
      
           <context-param>
                <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                <param-value>.xhtml</param-value>
           </context-param>
               <context-param>
              <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
              <param-value>server</param-value>
           </context-param>
          <context-param>
             <param-name>com.sun.faces.disableVersionTracking</param-name>
             <param-value>true</param-value>
           </context-param>
           <context-param>
              <param-name>com.sun.faces.enableRestoreView11Compatibility</param-name>
              <param-value>true</param-value>
           </context-param>
           <context-param>
                <param-name>javax.faces.CONFIG_FILES</param-name>
                <param-value>/WEB-INF/faces-managed-beans.xml, /WEB-INF/faces-navigation.xml</param-value>
           </context-param>
      
          <context-param>
            <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
            <param-value>com.sun.facelets.FaceletViewHandler</param-value>
          </context-param>
      
          <context-param>
                 <param-name>org.ajax4jsf.handleViewExpiredOnClient</param-name>
               <param-value>true</param-value>
           </context-param>
      
           <listener>
              <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
          </listener>
           
          <listener>
                  <listener-class>uy.com.its.util.PersistenceAppListener</listener-class>
             </listener>     
             
             <!-- richfaces -->
      
          <filter>
              <display-name>RichFaces Filter</display-name>
              <filter-name>richfaces</filter-name>
              <filter-class>org.ajax4jsf.Filter</filter-class>
          </filter>
      
          <filter-mapping> 
              <filter-name>richfaces</filter-name> 
              <servlet-name>Faces Servlet</servlet-name>
              <dispatcher>REQUEST</dispatcher>
              <dispatcher>FORWARD</dispatcher>
              <dispatcher>INCLUDE</dispatcher>
          </filter-mapping>
      
          <filter>
                <filter-name>AuthenticationFilter</filter-name>
                <filter-class>uy.com.its.util.AuthenticationFilter</filter-class>
           </filter>
           
          <filter-mapping>
                <filter-name>AuthenticationFilter</filter-name>
                <url-pattern>*.faces</url-pattern>
           </filter-mapping>
           <servlet>
                <servlet-name>Faces Servlet</servlet-name>
                <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                <load-on-startup>1</load-on-startup>
           </servlet>
      
          <session-config>
              <session-timeout>2</session-timeout>
          </session-config>
      
           <!-- Faces Servlet Mapping -->
           <servlet-mapping>
                <servlet-name>Faces Servlet</servlet-name>
                <url-pattern>*.faces</url-pattern>
           </servlet-mapping>
      
          <servlet>  
                <servlet-name>Initialize</servlet-name>   
                   <servlet-class>uy.com.its.util.timer.InitTimerService</servlet-class>   
                   <load-on-startup>1</load-on-startup>   
           </servlet>
                
           <servlet>
                <servlet-name>Chartlet</servlet-name>
                <servlet-class>net.sf.jsfcomp.chartcreator.Chartlet</servlet-class>
           </servlet>
           
           <servlet-mapping>
                <servlet-name>Chartlet</servlet-name>
                <url-pattern>*.chart</url-pattern>
           </servlet-mapping>
           
           <welcome-file-list>
                <welcome-file>/login.jsp</welcome-file>
                <welcome-file>/index.jsp</welcome-file>
                <welcome-file>/index.html</welcome-file>
           </welcome-file-list>
      
      </web-app>
      

      Anyone have any idea?

       

      Thanks in advance.

       

      Regards