4 Replies Latest reply on Sep 27, 2005 10:30 AM by Doug Schnelzer

    two portles using myfaces and navigation

    Stefan Tausendpfund Newbie

      Hello,

      I enhanced the cardemo portlet using myfaces and added two porlets on the left side. In this additional portles I use the jsf navigation with commandLink and commandButton. Using the commandLink only the first portlet follows the link. The second does not work. Using the the commandButton navigation works fine.
      here the sample code for the first portlet:
      userHome.jsp:

      <f:view>
       <h:form>
       <h:outputText value="This is userHome.jsp" />
       <br/><br/>
       <h:commandButton id="userHomeToForward" action="goForward" value="Go forward" />
       </h:form>
       <h:commandLink id="userHomeToForward" action="goForward" value="Go forward" />
       </f:view>
      
      navigates to userForward.jsp:
       <f:view>
       <h:form>
       <h:outputText value="This is userForward.jsp" />
       <br/><br/>
       <h:commandButton id="userForwardToHome" action="goBack" value="Go back" />
       </h:form>
       <h:commandLink id="userForwardToHome" action="goBack" value="Go back" />
       </f:view>
      
      faces-config.xml:
      <navigation-rule>
       <from-view-id>/userHome.jsp</from-view-id>
       <navigation-case>
       <description>Go Forward</description>
       <from-outcome>goForward</from-outcome>
       <to-view-id>/userForward.jsp</to-view-id>
       </navigation-case>
       </navigation-rule>
       <navigation-rule>
       <from-view-id>/userForward.jsp</from-view-id>
       <navigation-case>
       <description>go Back</description>
       <from-outcome>goBack</from-outcome>
       <to-view-id>/userHome.jsp</to-view-id>
       </navigation-case>
       </navigation-rule>
      


      The second portlet looks the same except the naming and ids differ.
      additionally the window is confiured like this:

      <window>
       <window-name>CarDemoWindow</window-name>
       <instance-ref>cardemo.CarDemoPortlet.CarDemoPortletInstance</instance-ref>
       <default>true</default>
       <region>center</region>
       <height>0</height>
       </window>
      <window>
       <window-name>CarDemoWindow3</window-name>
       <instance-ref>cardemo.CarDemoPortlet3.CarDemoPortletInstance3</instance-ref>
       <default>true</default>
       <region>left</region>
       <height>0</height>
       </window>
       <window>
       <window-name>CarDemoWindow2</window-name>
       <instance-ref>cardemo.CarDemoPortlet2.CarDemoPortletInstance2</instance-ref>
       <default>true</default>
       <region>left</region>
       <height>0</height>
       </window>