I am trying to create a menu with two level navigation. The first level
is tabs and the second level is bar. 

 

The problem is the second level bar never gets showed.

 

/WEB-INF/menu-metadata.xml:

<?xml version="1.0" encoding="iso-8859-1"?>

<menu xmlns="http://myfaces.apache.org/trinidad/menu";>

  <groupNode id="gn1" idref="form1" label="Global 0">

    <itemNode id="form1" label="Tab 0" action="form1"
focusViewId="/callForm1" destination="#"/> 

    <itemNode id="form2" label="Tab 1" action="form2"
focusViewId="/callForm2" destination="#"/> 

  </groupNode>

  <itemNode id="form3" label="Global 1" action="form3"
focusViewId="/callForm3" destination="#"/>

</menu>

(note: destination is set to # because I want stay in the same page)

 

/WEB-INF/faces-config.xml

...

<managed-bean>

    <managed-bean-name>root_menu</managed-bean-name>

 
<managed-bean-class>org.apache.myfaces.trinidad.model.XMLMenuModel</mana
ged-bean-class>

    <managed-bean-scope>request</managed-bean-scope>

    <managed-property>

      <property-name>createHiddenNodes</property-name>

      <value>true</value>

    </managed-property>

    <managed-property>

      <property-name>source</property-name>

      <property-class>java.lang.String</property-class>

      <value>/WEB-INF/menu-metadata.xml</value>

    </managed-property>

  </managed-bean>

  

 <navigation-rule>

<navigation-case>

            <from-outcome>form1</from-outcome>

                  <to-view-id>/callForm1</to-view-id>

            </navigation-case>

      <navigation-case>

            <from-outcome>form2</from-outcome>

            <to-view-id>/callForm2</to-view-id>

      </navigation-case>

      <navigation-case>

            <from-outcome>form3</from-outcome>

            <to-view-id>/callForm3</to-view-id>

      </navigation-case>

</navigation-rule>

...

 

xmlMenuModelTest.jspx

<f:view>

  <tr:document title="XMLMenuModule">

            <tr:form id="resources">

            <tr:panelPage>

            <f:facet name="navigation2">

            <tr:navigationPane id="firstLevel" var="foo"
value="#{root_menu}" level="0" hint="tabs">

              <f:facet name="nodeStamp">

                <tr:commandNavigationItem

                  text="#{foo.label}" action="#{foo.doAction}"
destination="#{foo.destination}"

                  rendered="#{foo.rendered}"/>

              </f:facet>

            </tr:navigationPane>

            </f:facet>

             

            <f:facet name="navigation3">

            <tr:navigationPane id="secondLevel" var="foo"
value="#{root_menu}" level="1" hint="bar">

              <f:facet name="nodeStamp">

                <tr:commandNavigationItem

                  text="#{foo.label}" action="#{foo.doAction}"
destination="#{foo.destination}"

                  rendered="#{foo.rendered}"/>

              </f:facet>

            </tr:navigationPane>

            </f:facet>

            </tr:panelPage>

            </tr:form>

  </tr:document>

  </f:view>

  

The result on xmlMenuModelTest.jspx page is like:

            

 -----------------------------

/Global 0 / Global 1/

|Global 0 | Global 1|

 

As you see, the page shows the menu with 2 levels. The top level shows
as tabs and the lower level shows bar which is good.

The problem is the lower level shows the labels same as the first level.
According to menu-meta.xml and the navigationPane level which set to
level 1, it should show Tab 0 and Tab 1 for the level 1.   

 

Thanks for your help. 

 

Napu Sun



 

 

Reply via email to