1 Reply Latest reply on Sep 1, 2009 1:19 PM by nbelaevski

    a4j components do not work on portlets

      Hi all,

      My configuration is as following

      Jboss Portal 2.7.2
      JSF 1.2
      Richfaces 3.3.0
      Portlet Bridge 1.0.0.CR1

      I have multiple portlets on the portal. The problem i am encountering is none of the ajax calls are working. I get viewExpired exception on all ajax calls and there is no problem with session being timed out.

      I suppose the problem is the component ids do not match between the client and the server. Changing the STATE_SAVING from server to client solves the issue for only firefox and i have clean the cache after each request to make it work. If i do not clear the cache, this time i get "facesContext is null exception"

      This code and configuration works when i do not use jboss portal, portlets, and portlet bridge.

      Can you help me about this? Am i missing a configuration etc?
      Here are my web.xml, faces-config.xml and jsp pages

      web.xml

      <?xml version="1.0"?>
      <web-app 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" version="2.4">
      
      
       <context-param>
       <param-name>org.richfaces.LoadStyleStrategy</param-name>
       <param-value>NONE</param-value>
       </context-param>
       <context-param>
       <param-name>org.richfaces.LoadScriptStrategy</param-name>
       <param-value>NONE</param-value>
       </context-param>
       <context-param>
       <param-name>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
       <param-value>rfRes</param-value>
       </context-param>
       <context-param>
       <param-name>javax.portlet.faces.renderPolicy</param-name>
       <param-value>NEVER_DELEGATE</param-value>
       </context-param>
      
       <filter>
       <display-name>Ajax4jsf Filter</display-name>
       <filter-name>ajax4jsf</filter-name>
       <filter-class>filters.AjaxFilter</filter-class>
       </filter>
       <filter>
       <filter-name>AuthenticationFilter</filter-name>
       <filter-class>filters.AuthenticationFilter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>ajax4jsf</filter-name>
       <servlet-name>FacesServlet</servlet-name>
       <dispatcher>FORWARD</dispatcher>
       <dispatcher>REQUEST</dispatcher>
       <dispatcher>INCLUDE</dispatcher>
       </filter-mapping>
       <filter-mapping>
       <filter-name>AuthenticationFilter</filter-name>
       <url-pattern>/*</url-pattern>
       </filter-mapping>
      
       <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>server</param-value>
       </context-param>
      
       <listener>
       <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
       </listener>
       <servlet>
       <servlet-name>FacesServlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
       <servlet-mapping>
       <servlet-name>FacesServlet</servlet-name>
       <url-pattern>/faces/*</url-pattern>
       </servlet-mapping>
      
       <jsp-config>
       <taglib>
       <taglib-uri>http://richfaces.org/rich</taglib-uri>
       <taglib-location>/WEB-INF/taglib/rich.tld</taglib-location>
       </taglib>
       <taglib>
       <taglib-uri>http://richfaces.org/a4j</taglib-uri>
       <taglib-location>/WEB-INF/taglib/a4j.tld</taglib-location>
       </taglib>
       </jsp-config>
      
      </web-app>


      faces-config.xml
      <?xml version="1.0"?>
      <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
       <!-- JBoss Portlet Bridge configuration -->
       <application>
       <view-handler> org.jboss.portletbridge.application.PortletViewHandler
       </view-handler>
       <action-listener>
       framework.ActionListener
       </action-listener>
       </application>
       <state-manager>
       org.jboss.portletbridge.application.PortalStateManager
       </state-manager>
       <factory>
       <faces-context-factory>
       org.jboss.portletbridge.context.FacesContextFactoryImpl
       </faces-context-factory>
       </factory>
       <managed-bean>
       <description>Home Details</description>
       <managed-bean-name>homeDetails</managed-bean-name>
       <managed-bean-class>
       home.HomeDetails
       </managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
       </managed-bean>
       <navigation-rule>
       <navigation-case>
       <from-outcome>progressView</from-outcome>
       <to-view-id>/jsp/progressView.jsp</to-view-id>
       </navigation-case>
       <navigation-case>
       <from-outcome>initialView</from-outcome>
       <to-view-id>/jsp/initialView.jsp</to-view-id>
       </navigation-case>
       </navigation-rule>
      </faces-config>


      jsp file
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      
      <a4j:form id="fid1">
       <h:outputText id="fid2" value="progressBar" />
       <rich:progressBar id="fid3" enabled="true" minValue="0" maxValue="99"
       value="#{homeDetails.progress}" interval="200">
       <f:facet name="initial">
       <h:outputText id="fid4" value="Process hasn't started yet" />
       </f:facet>
       <f:facet name="complete">
       <h:outputText id="fid5" value="Process Done" />
       </f:facet>
      
       <h:outputText id="fid6" value="#{homeDetails.progress} %"></h:outputText>
       </rich:progressBar>
      </a4j:form>


      Any help would be appreciated.
      Thanks,
      Koray