8 Replies Latest reply on Apr 9, 2010 2:51 AM by pascal dev

    portlet RichFaces problem

    pascal dev Newbie

      I try to make a first sample of portlet with richFaces and deploy it under gateIn.

      the environment is :

      - GateIn with JBoss AS 5.1.0 JDK6

      - JDK 6

      - portletbridge 2.0.0.CR1

      - Richfaces 3.3.2

       

      the project contains :

      - a managed bean

       

      public class User {
          private String name="";
          public String getName() {
          return name;
          }
          public void setName(String name) {
          this.name = name;
          }
      }

       

      - one jsp :

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <!-- RichFaces tag library declaration -->
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

       

      <f:view>
          <a4j:form>
              <rich:panel header="RichFaces Greeter" style="width: 315px">
                  <h:outputText value="Your name: " />
                  <h:inputText value="#{user.name}" >
                      <f:validateLength minimum="1" maximum="30" />
                  </h:inputText>
                  <a4j:commandButton value="Get greeting" reRender="greeting" />
                  <h:panelGroup id="greeting" >
                      <h:outputText value="Hello, " rendered="#{not empty user.name}" />
                      <h:outputText value="#{user.name}" />
                      <h:outputText value="!" rendered="#{not empty user.name}" />
                  </h:panelGroup>
              </rich:panel>
          </a4j:form>
      </f:view>

       

      In the WEB-INF, we have :

       

      - face-config :

       

      <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
                    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"
                    version="1.2">

       

          <application>
            <view-handler>org.jboss.portletbridge.application.PortletViewHandler</view-handler>
            <state-manager>org.jboss.portletbridge.application.PortletStateManager</state-manager>
         </application>
        
         <managed-bean>
            <managed-bean-name>controler</managed-bean-name>
            <managed-bean-class>
               mypackage.User
            </managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
            <managed-property>
              <property-name>name</property-name>
              <property-class>java.lang.String</property-class>
              <value/>
            </managed-property>
         </managed-bean>
      </faces-config>

       

      - portlet.xml :

       

      <?xml version="1.0" encoding="UTF-8"?>
      <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
      version="2.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
         http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
         <portlet>
            <portlet-name>RichfacesComponentPortlet</portlet-name>
            <portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
            <supports>
               <mime-type>text/html</mime-type>
               <portlet-mode>view</portlet-mode>
            </supports>
            <portlet-info>
               <title>Richfaces component portlet</title>
            </portlet-info>
               
            <init-param>
               <name>javax.portlet.faces.defaultViewId.view</name>
               <value>/jsp/start.jsp</value>
            </init-param>

       

         </portlet>
      </portlet-app>

       

      - web.xml :

       

      <?xml version="1.0"?>
      <web-app 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.5">

       


         <context-param>
            <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
            <param-value>.jsp</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>javax.portlet.faces.RENDER_POLICY</param-name>
            <param-value>NEVER_DELEGATE</param-value>
         </context-param>

       

         <servlet>
            <servlet-name>Faces Servlet</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
         </servlet>

       

         <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>/faces/*</url-pattern>
         </servlet-mapping>

       

         <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>*.resource</url-pattern>
         </servlet-mapping>

       

         <filter>
          <display-name>RichFaces Filter</display-name>
          <filter-name>richfaces</filter-name>
          <filter-class>org.ajax4jsf.Filter</filter-class>
        </filter>
       
      </web-app>

       

      An exception is launched when we try to rerender the <h:panelGroup id="greeting" > .

       

      java.lang.UnsupportedOperationException
          at javax.faces.context.ExternalContext.getRequestCharacterEncoding(ExternalContext.java:672)

          .....

          Caused by: javax.portlet.faces.BridgeException: Error processing resource lifecycle
          at org.jboss.portletbridge.ExceptionHandlerBase.processResourceException(ExceptionHandlerBase.java:117)
          at org.jboss.portletbridge.AjaxPortletBridge.doFacesRequest(AjaxPortletBridge.java:817)
          at javax.portlet.faces.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:541)
          ... 103 more
      Caused by: java.lang.UnsupportedOperationException
          at javax.faces.context.ExternalContext.getRequestCharacterEncoding(ExternalContext.java:672)
          at com.sun.faces.application.ViewHandlerImpl.initView(ViewHandlerImpl.java:118)
          at javax.faces.application.ViewHandlerWrapper.initView(ViewHandlerWrapper.java:175)
          at org.ajax4jsf.application.ViewHandlerWrapper.initView(ViewHandlerWrapper.java:128)
          at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:102)
          at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
          at org.jboss.portletbridge.AjaxPortletBridge.execute(AjaxPortletBridge.java:1076)
          at org.jboss.portletbridge.AjaxPortletBridge.doFacesRequest(AjaxPortletBridge.java:806)
          ... 104 more

        • 1. Re: portlet RichFaces problem
          Benjamin Seyinbour Expert

          Hello pascal,

           

          Take a look at your managed bean entry in the faces-config.xml:

           

          <managed-bean-name>controler</managed-bean-name>

           

          But you are using 'user' instead of 'controler' in your jsp. The simple solution is to replace 'controler' with 'user' e.g.,

           

          <managed-bean-name>user</managed-bean-name>

           

          I hope it works for you.

          1 of 1 people found this helpful
          • 2. Re: portlet RichFaces problem
            pascal dev Newbie

            I change the face-config.xml :

             

            <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
                          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"
                          version="1.2">

             

                <application>
                  <view-handler>org.jboss.portletbridge.application.PortletViewHandler</view-handler>
                  <state-manager>org.jboss.portletbridge.application.PortletStateManager</state-manager>
               </application>
              
               <managed-bean>
                  <managed-bean-name>user</managed-bean-name>
                  <managed-bean-class>
                    mypackage.User
                  </managed-bean-class>
                  <managed-bean-scope>session</managed-bean-scope>
                  <managed-property>
                    <property-name>name</property-name>
                    <property-class>java.lang.String</property-class>
                    <value/>
                  </managed-property>
               </managed-bean>
            </faces-config>

             

            the jsp is changed too :

             

            <%@ 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/a4j" prefix="a4j"%>
            <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

             

            <f:view>
                <a4j:form>
                    <h:outputText value="Your name: " />
                       <h:inputText value="#{user.name}"/>   
                       <h:inputText value="#{user.name}" >
                        <f:validateLength minimum="1" maximum="30" />
                    </h:inputText>
                    <h:panelGroup id="greeting" >
                        <h:outputText value="Hello, " rendered="#{not empty user.name}" />
                        <h:outputText value="#{user.name}" />
                        <h:outputText value="!" rendered="#{not empty user.name}" />
                    </h:panelGroup>   
                </a4j:form>
            </f:view>

             

            The portlet is correctly deployed. But, an exception is launched when we try to view the portlet window :

             

            javax.portlet.PortletException: Error process faces request
                at javax.portlet.faces.GenericFacesPortlet.doFacesDispatch(GenericFacesPortlet.java:600)
                at javax.portlet.faces.GenericFacesPortlet.doView(GenericFacesPortlet.java:486)
                at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)

            .....

             

            Caused by: javax.portlet.faces.BridgeException: Error processing render lifecycle
                at org.jboss.portletbridge.ExceptionHandlerBase.processRenderException(ExceptionHandlerBase.java:62)
                at org.jboss.portletbridge.AjaxPortletBridge.doFacesRequest(AjaxPortletBridge.java:669)
                at javax.portlet.faces.GenericFacesPortlet.doFacesDispatch(GenericFacesPortlet.java:598)

             

            ....

            Caused by: com.sun.facelets.FaceletException: Error Parsing /jsp/start_old.jsp: Error Traced[line: 1] The markup in the document preceding the root element must be well-formed.
                at com.sun.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:234)
                at com.sun.facelets.compiler.Compiler.compile(Compiler.java:105)
                at com.sun.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:218)
                at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:149)
                at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:100)
                at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:517)
                at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:567)
                at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
                at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
                at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
                at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
                at org.jboss.portletbridge.AjaxPortletBridge.render(AjaxPortletBridge.java:1080)
                at org.jboss.portletbridge.AjaxPortletBridge.renderResponse(AjaxPortletBridge.java:894)
                at org.jboss.portletbridge.AjaxPortletBridge.doFacesRequest(AjaxPortletBridge.java:636)

            • 3. Re: portlet RichFaces problem
              Benjamin Seyinbour Expert

              Hello pascal,

               

              Eyeball checks of your code doesn't highlight any error, but have you changed your jsp (formerly /jsp/start.jsp) to /jsp/start_old.jsp?

              But importantly, do you have 'xercesImpl.jar' or 'xml-apis.jar'  or both in your web application web-inf/lib directory?  if so, remove or delete them. JBoss already has copies in its lib. Try that and see if it solves your problem.

              1 of 1 people found this helpful
              • 4. Re: portlet RichFaces problem
                pascal dev Newbie

                I give you the pom.xml used:

                 

                <?xml version="1.0" encoding="UTF-8"?>
                <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
                  <modelVersion>4.0.0</modelVersion>
                  <parent>
                    <groupId>mypackage.gatein.myportlet.test</groupId>
                    <artifactId>testportlet</artifactId>
                    <version>1.0.0-SNAPSHOT</version>
                  </parent>
                 
                  <artifactId>jsf_richfaces_component_portlet</artifactId>
                  <name>jsf_richfaces_component_portlet</name>
                  <packaging>war</packaging>

                 

                  <build>
                      <finalName>JSFRichfacesComponentPortlet</finalName>

                 

                  </build>

                 

                  <!-- Dependencies -->
                  <dependencies>
                    <dependency>
                      <groupId>javax.portlet</groupId>
                      <artifactId>portlet-api</artifactId>
                      <version>2.0</version>
                      <scope>provided</scope>
                    </dependency>
                   
                     <!-- Portlet bridge -->
                      <dependency>
                         <groupId>org.jboss.portletbridge</groupId>
                         <artifactId>portletbridge-api</artifactId>
                         <version>2.0.0.CR1</version>
                      </dependency>

                 

                      <dependency>
                         <groupId>org.jboss.portletbridge</groupId>
                         <artifactId>portletbridge-impl</artifactId>
                         <version>2.0.0.CR1</version>
                      </dependency>
                     
                      <dependency>
                          <groupId>javax.el</groupId>
                          <artifactId>el-api</artifactId>
                          <version>1.0</version>
                          <scope>provided</scope>
                      </dependency>
                      <dependency>
                          <groupId>javax.servlet</groupId>
                          <artifactId>jstl</artifactId>
                          <version>1.1.2</version>
                          <scope>provided</scope>
                      </dependency>
                      <dependency>
                          <groupId>javax.faces</groupId>
                          <artifactId>jsf-api</artifactId>
                          <version>1.2</version>
                          <scope>provided</scope>
                      </dependency>
                      <dependency>
                          <groupId>javax.faces</groupId>
                          <artifactId>jsf-impl</artifactId>
                          <version>1.2-b19</version>
                          <scope>provided</scope>
                      </dependency>
                     
                      <dependency>
                          <groupId>org.richfaces.framework</groupId>
                          <artifactId>richfaces-api</artifactId>
                          <version>3.3.2.SR1</version>
                      </dependency>
                      <dependency>
                          <groupId>org.richfaces.framework</groupId>
                          <artifactId>richfaces-impl</artifactId>
                          <version>3.3.2.SR1</version>
                      </dependency>
                      <dependency>
                          <groupId>org.richfaces.ui</groupId>
                          <artifactId>richfaces-ui</artifactId>
                          <version>3.3.2.SR1</version>
                      </dependency>
                      <!--
                      <dependency>
                        <groupId>com.sun.facelets</groupId>
                        <artifactId>jsf-facelets</artifactId>
                        <version>1.1.15.B1</version>
                      </dependency>
                       -->
                </dependencies>
                </project>

                 

                so, there are in the WEB-INF/lib :

                 

                commons-beanutils-1.7.0.jar

                commons-collections-3.2.jar

                commons-digester-1.8.1.jar

                commons-logging-1.0.4.jar

                portletbridge-api-2.0.0.CR1.jar

                portletbridge-impl-2.0.0.CR1.jar

                jsf-facelets-1.1.15.B1.jar

                portletbridge-api-2.0.0.CR1.jar

                portletbridge-impl-2.0.0.CR1.jar

                richfaces-api-3.3.2.SR1.jar

                richfaces-impl-3.3.2.SR1.jar

                richfaces-ui-3.3.2.SR1.jar

                 

                Thanks for your help

                • 5. Re: portlet RichFaces problem
                  Benjamin Seyinbour Expert

                  Is it a typo or do you have duplicate copies of:

                   

                  portletbridge-api-2.0.0.CR1.jar
                  portletbridge-impl-2.0.0.CR1.jar

                   


                  The following jars should also not be in your (packaged)  WEB-INF/lib:

                   

                  jstl
                  jsf-api
                  jsf-impl
                  el-api

                   

                  Finally, are you still having the same  "well-formed" problem or is it now a different problem?

                  • 6. Re: portlet RichFaces problem
                    pascal dev Newbie

                    Thanks a lot for your help Benjamin .

                     

                    the problem is resolved. Indeed, the parsing exception is caused by the jsp format. I changed it to xhml, no it is working.

                     

                    If you want a kick start sample about RichFaces + PortletBridge 2 + GateIn, i show all the code :

                     

                    pom.xml :

                     

                    <?xml version="1.0" encoding="UTF-8"?>
                    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
                      <modelVersion>4.0.0</modelVersion>
                      <parent>
                        <groupId>mypackage.portlet.test</groupId>
                        <artifactId>testportlet</artifactId>
                        <version>1.0.0-SNAPSHOT</version>
                      </parent>
                     
                      <artifactId>jsf_richfaces_component_portlet</artifactId>
                      <name>jsf_richfaces_component_portlet</name>
                      <packaging>war</packaging>

                     

                      <build>
                          <finalName>JSFRichfacesComponentPortlet</finalName>

                     

                      </build>

                     

                      <!-- Dependencies -->
                      <dependencies>
                        <dependency>
                          <groupId>javax.portlet</groupId>
                          <artifactId>portlet-api</artifactId>
                          <version>2.0</version>
                          <scope>provided</scope>
                        </dependency>
                       
                         <!-- Portlet bridge -->
                          <dependency>
                             <groupId>org.jboss.portletbridge</groupId>
                             <artifactId>portletbridge-api</artifactId>
                             <version>2.0.0.CR1</version>
                          </dependency>

                     

                          <dependency>
                             <groupId>org.jboss.portletbridge</groupId>
                             <artifactId>portletbridge-impl</artifactId>
                             <version>2.0.0.CR1</version>
                          </dependency>
                         
                          <dependency>
                              <groupId>javax.el</groupId>
                              <artifactId>el-api</artifactId>
                              <version>1.0</version>
                              <scope>provided</scope>
                          </dependency>
                          <dependency>
                              <groupId>javax.servlet</groupId>
                              <artifactId>jstl</artifactId>
                              <version>1.1.2</version>
                              <scope>provided</scope>
                          </dependency>
                          <dependency>
                              <groupId>javax.faces</groupId>
                              <artifactId>jsf-api</artifactId>
                              <version>1.2</version>
                              <scope>provided</scope>
                          </dependency>
                          <dependency>
                              <groupId>javax.faces</groupId>
                              <artifactId>jsf-impl</artifactId>
                              <version>1.2-b19</version>
                              <scope>provided</scope>
                          </dependency>
                         
                          <dependency>
                              <groupId>org.richfaces.framework</groupId>
                              <artifactId>richfaces-api</artifactId>
                              <version>3.3.2.SR1</version>
                          </dependency>
                          <dependency>
                              <groupId>org.richfaces.framework</groupId>
                              <artifactId>richfaces-impl</artifactId>
                              <version>3.3.2.SR1</version>
                          </dependency>
                          <dependency>
                              <groupId>org.richfaces.ui</groupId>
                              <artifactId>richfaces-ui</artifactId>
                              <version>3.3.2.SR1</version>
                          </dependency>
                         
                          <dependency>
                            <groupId>com.sun.facelets</groupId>
                            <artifactId>jsf-facelets</artifactId>
                            <version>1.1.15.B1</version>
                          </dependency>
                    </dependencies>

                     

                    Project Structure :

                    jsf_richfaces_component_portlet

                    |

                    |---src

                         | --- main

                                 | --- java

                                         | --- mypackage

                                                      |---- User.java

                                 | --- webapp

                                         | --- WEB-INF

                                                      | --- web.xml

                                                      | --- faces-config.xml

                                                      | --- portlet.xml

                                         | --- View

                                                  | --- myView.xhtml

                    |--- pom.xml  

                     

                    User.java :

                     

                    package mypackage;

                     

                    public class User {
                       
                        private String name = "";
                       
                        public String getName() {
                            return this.name;
                        }
                       
                        public void setName(String name) {
                            this.name = name;
                        }
                    }

                     

                    myView.xhtml :

                     

                    <html xmlns="http://www.w3.org/1999/xhtml"
                        xmlns:ui="http://java.sun.com/jsf/facelets"
                        xmlns:h="http://java.sun.com/jsf/html"
                        xmlns:f="http://java.sun.com/jsf/core"
                        xmlns:a4j="http://richfaces.org/a4j"
                        xmlns:rich="http://richfaces.org/rich">

                     

                        <f:view>
                            <a4j:form>
                                <h:outputText value="Your name: " />
                                   <h:inputText value="#{user.name}"/>   
                                   <h:inputText value="#{user.name}" >
                                    <f:validateLength minimum="1" maximum="30" />
                                </h:inputText>
                                <a4j:commandButton value="Get greeting" reRender="greeting" />
                                <h:panelGroup id="greeting" >
                                    <h:outputText value="Hello, " rendered="#{not empty user.name}" />
                                    <h:outputText value="#{user.name}" />
                                    <h:outputText value="!" rendered="#{not empty user.name}" />
                                </h:panelGroup>   
                            </a4j:form>
                        </f:view>
                    </html>

                     

                    web.xml :

                     

                    <?xml version="1.0"?>
                    <web-app 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.5">

                     


                       <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>javax.portlet.faces.RENDER_POLICY</param-name>
                          <param-value>NEVER_DELEGATE</param-value>
                       </context-param>

                     

                       <servlet>
                          <servlet-name>Faces Servlet</servlet-name>
                          <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                          <load-on-startup>1</load-on-startup>
                       </servlet>

                     

                       <servlet-mapping>
                          <servlet-name>Faces Servlet</servlet-name>
                          <url-pattern>/faces/*</url-pattern>
                       </servlet-mapping>

                     

                       <servlet-mapping>
                          <servlet-name>Faces Servlet</servlet-name>
                          <url-pattern>*.resource</url-pattern>
                       </servlet-mapping>

                       <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>
                     
                       <!-- CONFIGURATION PORTLET BRIDGE JSF + RICHFACES -->
                     
                      <context-param>
                        <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
                        <param-value>org.jboss.portletbridge.application.FaceletPortletViewHandler</param-value>
                      </context-param>

                     

                      <context-param>
                        <param-name>javax.portlet.faces.renderPolicy</param-name>
                        <param-value>ALWAYS_DELEGATE</param-value>
                      </context-param>
                      
                      <!-- END SNIPPET: params portlet bridge jsf -->
                     
                      <!-- START SNIPPET: servlet portlet container exo -->
                      <servlet>
                       <servlet-name>PortletWrapper</servlet-name>
                       <servlet-class>
                          org.exoplatform.services.portletcontainer.impl.servlet.ServletWrapper
                       </servlet-class>
                      </servlet>
                     
                      <servlet-mapping>
                        <servlet-name>PortletWrapper</servlet-name>
                        <url-pattern>/PortletWrapper</url-pattern>
                      </servlet-mapping>
                      <!-- END SNIPPET: servlet portlet container exo -->
                     
                      <!-- START SNIPPET: listener exo portlet -->
                      <!-- Listener JSF -->
                      <listener>
                       <listener-class>
                        org.exoplatform.services.portletcontainer.impl.servlet.PortletApplicationListener
                       </listener-class>
                      </listener>
                     
                    </web-app>

                     

                    faces-config.xml :

                     

                    <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
                                  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"
                                  version="1.2">

                     

                        <application>
                          <view-handler>org.jboss.portletbridge.application.PortletViewHandler</view-handler>
                          <state-manager>org.jboss.portletbridge.application.PortletStateManager</state-manager>
                       </application>
                      
                       <managed-bean>
                          <managed-bean-name>user</managed-bean-name>
                          <managed-bean-class>
                             mypackage.User
                          </managed-bean-class>
                          <managed-bean-scope>session</managed-bean-scope>
                          <managed-property>
                            <property-name>name</property-name>
                            <property-class>java.lang.String</property-class>
                            <value/>
                          </managed-property>
                       </managed-bean>
                    </faces-config>

                     

                    portlet.xml :

                     

                    <?xml version="1.0" encoding="UTF-8"?>
                    <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
                    version="2.0"
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                       xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
                       http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
                       <portlet>
                          <portlet-name>RichfacesComponentPortlet</portlet-name>
                          <portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
                          <supports>
                             <mime-type>text/html</mime-type>
                             <portlet-mode>view</portlet-mode>
                          </supports>
                          <portlet-info>
                             <title>Richfaces component portlet</title>
                          </portlet-info>
                             
                          <init-param>
                             <name>javax.portlet.faces.defaultViewId.view</name>
                             <value>/view/myview.xhtml</value>
                          </init-param>

                       </portlet>
                    </portlet-app>

                     

                     

                    Can you give me advise about the configuration of web.xml files, portlet.xml to acquire the best config of portlet for GateIn ?

                     

                    Thanks you

                    • 7. Re: portlet RichFaces problem
                      Benjamin Seyinbour Expert

                      Your web.xml looks like mine. Although mine doesn't  have the following:

                       

                      <servlet>
                      <servlet-name>PortletWrapper</servlet-name>
                      <servlet-class>
                      org.exoplatform.services.portletcontainer.impl.servlet.ServletWrapper
                      </servlet-class>
                      </servlet>

                       

                      <servlet-mapping>
                      <servlet-name>PortletWrapper</servlet-name>
                      <url-pattern>/PortletWrapper</url-pattern>
                      </servlet-mapping>

                       

                      <listener>
                      <listener-class>
                      org.exoplatform.services.portletcontainer.impl.servlet.PortletApplicationListener
                      </listener-class>
                      </listener>

                       


                      I had them in the past but removed them and my portlet still woks. I think they are for exo backward compatibility which you don't  really need if you are using GateIn. They are noise -- try without them.

                       

                      But better to start small and add by increments so that you can justify why you have the entry in your *.xml file. Some times you may have too many entries that are not applicable to your case but will nevertheless use up CPU resources e.g., longer JBoss start-up times.

                      • 8. Re: portlet RichFaces problem
                        pascal dev Newbie

                        Hello Benjamin,

                         

                        i tryed without the exo servlet and listener declaration in the web.xml file :

                         

                        <!-- START SNIPPET: servlet portlet container exo -->
                          <!--
                          <servlet>
                           <servlet-name>PortletWrapper</servlet-name>
                           <servlet-class>
                              org.exoplatform.services.portletcontainer.impl.servlet.ServletWrapper
                           </servlet-class>
                          </servlet>
                         
                          <servlet-mapping>
                            <servlet-name>PortletWrapper</servlet-name>
                            <url-pattern>/PortletWrapper</url-pattern>
                          </servlet-mapping>

                         

                        <!-- START SNIPPET: listener exo portlet -->

                        <listener>
                           <listener-class>
                            org.exoplatform.services.portletcontainer.impl.servlet.PortletApplicationListener
                           </listener-class>
                          </listener>

                         

                        Thanks for your advise, it is still working. SO this configuration is efficient for exo portal, but not for GateIn.