Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-549

faces navigation rules not working for two portlets on portal page

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 1.1.1
    • None
    • General
    • None
    • Linux 2.6.12, Java 1.5.0_04, Liferay Pro 3.6.1 (portla), nightly build (20050909)

    Description

      I'm trying to write some JSF portlets within one portlet application
      but encountered some problems concerning navigation rules when I
      put more than one JSF portlet per portal page.

      When I put just one portlet on my page everything concerning the
      navigation rules (with <h:commandButton action="p1next" value="go on"
      /> stuff) works fine and I get to the next view.

      But when I put a second faces portlet on the page navigation and invoking
      actions on backing beans in the second portlet just doesn't work at all.

      If I remove both portlets and put the second portlet on the page again (so that
      I'm having just one portlet again) this portlet works fine as well. So I assume
      that navigation settings in faces-config.xml must be correct. It has
      something to do
      with the arrangement of two faces portlets on the portal page so that
      the second one
      stops working as expected.

      I also tried to use distinct IDs for all ui-components and also
      distinct <from-output>-values but that doesn't help

      Thanks
      zeroconf

      Attached are the important parts of my web.xml, faces-config.xml and portlet.xml

      web.xml
      ============================

      <?xml version="1.0"?>
      <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
      Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

      <web-app>
      <display-name>PROJECT_NAME</display-name>

      <context-param>
      <param-name>company_id</param-name>
      <param-value>liferay.com</param-value>
      </context-param>
      <context-param>
      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
      <param-value>client</param-value>
      </context-param>
      <context-param>
      <param-name>javax.faces.application.CONFIG_FILES</param-name>
      <param-value>/WEB-INF/faces-config.xml</param-value>
      </context-param>
      <listener>

      <listener-class>com.liferay.portal.servlet.PortletContextListener</listener-class>
      </listener>
      <listener>

      <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
      </listener>
      <servlet>
      <servlet-name>PROJECT_NAME</servlet-name>

      <servlet-class>com.liferay.portal.servlet.PortletServlet</servlet-class>
      <init-param>
      <param-name>portlet-class</param-name>

      <param-value>org.apache.myfaces.portlet.MyFacesGenericPortlet</param-value>
      </init-param>
      <load-on-startup>0</load-on-startup>
      </servlet>
      <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>PROJECT_NAME</servlet-name>
      <url-pattern>/PROJECT_NAME/*</url-pattern>
      </servlet-mapping>
      <taglib>
      <taglib-uri>http://java.sun.com/portlet</taglib-uri>

      <taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location>
      </taglib>
      </web-app>

      faces-config.xml:
      ==================

      <?xml version="1.0"?>
      <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD
      JavaServer Faces Config 1.1//EN"
      "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

      <faces-config xmlns="http://java.sun.com/JSF/Configuration">
      <factory>

      <faces-context-factory>org.apache.myfaces.context.MyFacesContextFactoryImpl</faces-context-factory>
      </factory>

      <!-- navigation for JSF portlet 1 -->
      <navigation-rule>
      <from-view-id>/jsp/jsf1/index.jsp</from-view-id>
      <navigation-case>
      <from-outcome>p1next</from-outcome>
      <to-view-id>/jsp/jsf1/n1.jsp</to-view-id>
      </navigation-case>
      </navigation-rule>
      <navigation-rule>
      <from-view-id>/jsp/jsf1/n1.jsp</from-view-id>
      <navigation-case>
      <from-outcome>p1back</from-outcome>
      <to-view-id>/jsp/jsf1/index.jsp</to-view-id>
      </navigation-case>
      </navigation-rule>

      <!-- navigation for JSF portlet 2 -->
      <navigation-rule>
      <from-view-id>/jsp/jsf2/index.jsp</from-view-id>
      <navigation-case>
      <from-outcome>p2next</from-outcome>
      <to-view-id>/jsp/jsf2/n1.jsp</to-view-id>
      </navigation-case>
      </navigation-rule>
      <navigation-rule>
      <from-view-id>/jsp/jsf2/n1.jsp</from-view-id>
      <navigation-case>
      <from-outcome>p2back</from-outcome>
      <to-view-id>/jsp/jsf2/index.jsp</to-view-id>
      </navigation-case>
      </navigation-rule>

      </faces-config>

      portlet.xml
      =============================

      <portlet>
      <portlet-name>jsf2</portlet-name>
      <display-name>jsf2</display-name>

      <portlet-class>org.apache.myfaces.portlet.MyFacesGenericPortlet</portlet-class>
      <init-param>
      <name>default-view</name>
      <value>/jsp/jsf2/index.jsp</value>
      </init-param>
      <supports>
      <mime-type>text/html</mime-type>
      </supports>
      <portlet-info>
      <title>jsf2</title>
      <short-title>jsf2</short-title>
      <keywords>jsf2</keywords>
      </portlet-info>
      </portlet>

      Attachments

        1. cardemo.war.zip
          2.54 MB
          Nhat Vo

        Activity

          People

            Unassigned Unassigned
            zeroconf zeroconf
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: