jsfprimefaceshighlighttabmenu

Tab menu with menu items having the same outcome


I'm using PrimeFaces <p:tabMenu>. Two of my menuItems have the same outcome with different URL parameters.

The behavior is the following : When I click on each item, I'm redirected to the right page (In this example: foo.xhtml with two different f values). However only the first tab is highlighted.

<p:tabMenu activeIndex="#{activeIndex}" styleClass="menuPanel">
        <p:menuitem value="foo" outcome="/pages/foo.xhtml?f=all">
        </p:menuitem>
        <p:menuitem value="bar" outcome="/pages/foo.xhtml?f=me">
        </p:menuitem>
        <p:menuitem value="hi" outcome="/pages/hi.xhtml">
        </p:menuitem>
</p:tabMenu>

Do you know how I could make the second tab work as expected, i.e. be highlighted whenever clicked ?


Solution

  • How do you set the activeindex? Activeindex controls the Highlighting. Set into your bean from foo.xhtml the right activeindex.