4 Replies Latest reply on Mar 6, 2009 6:55 PM by Alexander Smirnov

    richfaces portlet

    Prasad Pillalamarri Newbie

      I am working on a project that uses richfaces based portlets running in liferay.

      With the following configuration action in context menu is invoked.

      <context-param>
      <param-name>facelets.BUILD_BEFORE_RESTORE</param-name>
      <param-value>false</param-value>
      </context-param>
      <context-param>
      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
      <param-value>client</param-value>
      </context-param>

      However it is breaking ajax calls.

      If the config is opp, false to true, client to server ajax calls are working but action in context menu is failing.

      Could you please provide any inputs or guide me to anyone who can provide help on jboss portletbridge for richfaces in liferay.

        • 1. Re: richfaces portlet
          Alexander Smirnov Master

          There is not enough information for answer.
          Can you provide information about products and libraries versions ( submit method does not work in liferay for bridge prior to beta 6 ), and part of the page code with menu components.
          Client-side state saving method is supported, but does not make sense for portal, because bridge have to store state in session to "render" calls support.

          • 2. Re: richfaces portlet
            Prasad Pillalamarri Newbie

            Hi alexsmirnov

            Thank you for your quick response and help.

            Please let me know should you need any further information to reproduce the issue.

            <?xml version="1.0" encoding="UTF-8"?>
            <web-app id="WebApp_ID" 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">
             <display-name>liferay_cso</display-name>
             <context-param>
             <param-name>javax.faces.CONFIG_FILES</param-name>
             <param-value>/WEB-INF/faces-config.xml,/WEB-INF/faces-config2.xml,/WEB-INF/hierarchy-faces-config.xml,/WEB-INF/quotefaces-config.xml,/WEB-INF/orderfaces-config.xml</param-value>
             </context-param>
             <context-param>
             <param-name>com.sun.faces.verifyObjects</param-name>
             <param-value>true</param-value>
             </context-param>
             <context-param>
             <param-name>com.sun.faces.validateXml</param-name>
             <param-value>false</param-value>
             </context-param>
             <context-param>
             <param-name>org.richfaces.SKIN</param-name>
             <param-value>laguna</param-value>
             </context-param>
             <context-param>
             <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
             <param-value>.jsp</param-value>
             </context-param>
             <context-param>
             <param-name>org.ajax4jsf.SKIN</param-name>
             <param-value>blueSky</param-value>
             </context-param>
            
            
            
            
            
             <context-param>
             <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
             <param-value>org.jboss.portletbridge.application.PortletViewHandler</param-value>
             </context-param>
             <!--
             org.jboss.portletbridge.application.FaceletPortletViewHandler
             org.jboss.portletbridge.application.PortletViewHandler
             com.sun.facelets.FaceletViewHandler
             -->
             <context-param>
            <param-name>facelets.BUILD_BEFORE_RESTORE</param-name>
            <param-value>true</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>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>javax.portlet.faces.renderPolicy</param-name>
             <param-value>ALWAYS_DELEGATE</param-value>
             </context-param>
             <context-param>
             <param-name>javax.faces.LIFECYCLE_ID</param-name>
             <param-value>DEFAULT</param-value>
             </context-param>
             <context-param>
             <param-name>facelets.DEVELOPMENT</param-name>
             <param-value>false</param-value>
             </context-param>
             <context-param>
             <param-name>facelets.SKIP_COMMENTS</param-name>
             <param-value>true</param-value>
             </context-param>
             <context-param>
             <param-name>org.richfaces.CONTROL_SKINNING</param-name>
             <param-value>enabled</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>facelets.REFRESH_PERIOD</param-name>
             <param-value>2</param-value>
             </context-param>
             <context-param>
             <param-name>org.ajax4jsf.xmlparser.ORDER</param-name>
             <param-value>NONE</param-value>
             </context-param>
            
            
            
             <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>
             <listener>
             <listener-class>com.liferay.portal.kernel.servlet.PortletContextListener</listener-class>
             </listener>
            
             <servlet>
             <servlet-name>Faces Servlet</servlet-name>
             <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
             <load-on-startup>1</load-on-startup>
             </servlet>
             <servlet>
             <servlet-name>SamplePortlet</servlet-name>
             <servlet-class>com.liferay.portal.kernel.servlet.PortletServlet</servlet-class>
             <init-param>
             <param-name>portlet-class</param-name>
             <param-value>com.sample.portlet.portlet.SamplePortlet</param-value>
             </init-param>
             <load-on-startup>0</load-on-startup>
             </servlet>
            
             <servlet>
             <servlet-name>demoPortlet</servlet-name>
             <servlet-class>com.liferay.portal.kernel.servlet.PortletServlet</servlet-class>
             <init-param>
             <param-name>portlet-class</param-name>
             <param-value>com.sample.portlet.portlet.SamplePortlet</param-value>
             </init-param>
             <load-on-startup>0</load-on-startup>
             </servlet>
            
             <servlet-mapping>
             <servlet-name>Faces Servlet</servlet-name>
             <url-pattern>*.jsp</url-pattern>
             </servlet-mapping>
             <servlet-mapping>
             <servlet-name>demoPortlet</servlet-name>
             <url-pattern>/demoPortlet/*</url-pattern>
             </servlet-mapping>
             <servlet-mapping>
             <servlet-name>SamplePortlet</servlet-name>
             <url-pattern>/SamplePortlet/*</url-pattern>
             </servlet-mapping>
             <session-config>
             <session-timeout>60</session-timeout>
             </session-config>
             <jsp-config>
             <taglib>
             <taglib-uri>http://java.sun.com/portlet_2_0</taglib-uri>
             <taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location>
             </taglib>
             <taglib>
             <taglib-uri>http://liferay.com/tld/portlet</taglib-uri>
             <taglib-location>/WEB-INF/tld/liferay-portlet-ext.tld</taglib-location>
             </taglib>
             <taglib>
             <taglib-uri>http://liferay.com/tld/security</taglib-uri>
             <taglib-location>/WEB-INF/tld/liferay-security.tld</taglib-location>
             </taglib>
             <taglib>
             <taglib-uri>http://liferay.com/tld/theme</taglib-uri>
             <taglib-location>/WEB-INF/tld/liferay-theme.tld</taglib-location>
             </taglib>
             <taglib>
             <taglib-uri>http://liferay.com/tld/ui</taglib-uri>
             <taglib-location>/WEB-INF/tld/liferay-ui.tld</taglib-location>
             </taglib>
             <taglib>
             <taglib-uri>http://liferay.com/tld/util</taglib-uri>
             <taglib-location>/WEB-INF/tld/liferay-util.tld</taglib-location>
             </taglib>
            
             </jsp-config>
            
            </web-app>
            


            I am using richfaces 3.3.0-GA , jboss portletbridge beta6, liferay 5.1.2

            I have a jsf in which there is a tabPanel with server, ajax and client slide submits.

            
            <ui:composition
             xmlns="http://www.w3.org/1999/xhtml"
             xmlns:s="http://jboss.com/products/seam/taglib"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:rich="http://richfaces.org/rich"
             xmlns:a4j="http://richfaces.org/a4j">
             <style>
             .label {
             font-weight: bold;
            }
             .cso_panel_header {
             font-size: 1em;
             border-top: 1px solid #017ae2;
             border-bottom: 1px solid #017ae2;
             background-color: #4C9600;
             background: url(../images/layout/gradient.jpg) no-repeat top left;
            }
            .rich-stglpanel-marker {float:left}
             </style>
             <f:loadBundle basename="order" var="msg"/>
             <h:form>
             <rich:tabPanel>
             <rich:tab label="First">
             Here is tab #1
             </rich:tab>
             <rich:tab label="Second">
             Here is tab #2
             </rich:tab>
             <rich:tab label="Third">
             Here is tab #3
             </rich:tab>
             </rich:tabPanel>
             <br/><br/>
             <p>Here is an example of tab panel switched in "ajax" style. Second tab is disabled.</p>
             <rich:tabPanel switchType="ajax">
             <rich:tab label="First">
             Here is tab #1
             </rich:tab>
             <rich:tab label="Second" disabled="true">
             Here is tab #2
             </rich:tab>
             <rich:tab label="Third">
             Here is tab #3
             </rich:tab>
             </rich:tabPanel>
             <br/><br/>
             <p>Here is an example of tab panel switched completely on client.</p>
             <rich:tabPanel switchType="client">
             <rich:tab label="First">
             Here is tab #1
             </rich:tab>
             <rich:tab label="Second">
             Here is tab #2
             </rich:tab>
             <rich:tab label="Third">
             Here is tab #3
             </rich:tab>
             </rich:tabPanel>
            
            
             </h:form>
            
            </ui:composition>
            


            I have another jsf where the tree has a context menu. one of the menu item has an action and the submit mode is server.

            <rich:tabPanel switchType="server">
            
             <rich:tab label="#{msg['order.offer']}">
             <h:form id="offerTree">
             <rich:tree style="width:300px" value="#{orderDetails.offerTree.data}" var="item" nodeFace="#{item.type}"
             stateAdvisor="#{csoTreeStateAdvisor}">
            
             <rich:treeNode type="customer" iconLeaf="/images/customer.gif" icon="/images/customer.gif">
             <h:outputText value="#{item.name}" id="customerNode"/>
             </rich:treeNode>
            
             <rich:treeNode type="offer" iconLeaf="/images/product_e.gif" icon="/images/product_e.gif" id="offerNode">
             <h:outputText value="#{item.name}" />
            
             <rich:contextMenu event="oncontextmenu" attached="true" attachTo="offerNode" >
             <rich:menuItem value="$ #{item.recurringCharges} / month" ></rich:menuItem>
             <rich:menuItem value="$ #{item.oneTimeCharges}" />
            
             <rich:menuSeparator height="5"/>
             <rich:menuItem submitMode="server" value="Details" action="#{orderDetails.details}"></rich:menuItem>
            
            
             </rich:contextMenu>
            
             </rich:treeNode>
            
             </rich:tree>
             </h:form>
             </rich:tab>
            
            
             </rich:tabPanel>
            


            With this context params defined in above web.xml, the first page works in ajax, server and client submits. The context menu in the second page fails, the action in the menu item is not forwarding to the next page.

            However if I change
            <context-param>
            <param-name>facelets.BUILD_BEFORE_RESTORE</param-name>
            <param-value>false</param-value>
             </context-param>
             <context-param>
             <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
             <param-value>client</param-value>
             </context-param>
            
            

            the context menu works, but the ajax call in the first page is broken.



            • 3. Re: richfaces portlet
              Prasad Pillalamarri Newbie

              what is the significance of facelets.BUILD_BEFORE_REQUEST ?

              if this is true ajax calls are working otherwise they break.

              what is the relation of javax.faces.STATE_SAVING_METHOD to action attribute of rich:menuItem ?

              My issue is in the liferay portal env. with jboss portletbridge for richfaces context menu works in one config of web.xml and is broken with another config where ajax calls work.

              With the following configuration action in context menu is invoked.

              <context-param>
              <param-name>facelets.BUILD_BEFORE_RESTORE</param-name>
              <param-value>false</param-value>
              </context-param>
              <context-param>
              <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
              <param-value>client</param-value>
              </context-param>

              However it is breaking ajax calls.

              If the config is opp, false to true, client to server ajax calls are working but action in context menu is failing.


              I have also given complete jsf and web.xml below.

              • 4. Re: richfaces portlet
                Alexander Smirnov Master

                Sorry for a long response - I've been busy for some other tasks. Also, I had to create a simple test to reproduce your problem.
                The simplified example works for me in the Liferay Portal 2.5.1 bundled with Jboss 4.2, with some changes :
                1) Faces Servlet mapping have been changed to *.jsf, while 'javax.faces.DEFAULT_SUFFIX' init param value setted as '.xhtml' - it is necessary for Facelets.
                2) All Liferay-related configuration have ben removed from the web.xml ( the built in application loader does it properly during deployment ).
                I did not test context menu in the tree yet, but it works properly from simple input component attached to the first page. It could be bug in the rich:tree component and I going to test it more carefully.
                The 'facelets.BUILD_BEFORE_RESTORE' should be used very carefully. Usually it can be used together with 'transient' flags to reduce saved state object in memory.
                Also, a client-side state does not make sence in the portlet case, because portlet bridge have to store it on the server for any case, it is specification requirement for 'render' resquests support.