具有相同结果的菜单项的选项卡菜单

Tab menu with menu items having the same outcome

我正在使用 PrimeFaces <p:tabMenu>。我的两个菜单项具有相同的结果,但 URL 参数不同。

行为如下: 当我单击每个项目时,我将被重定向到正确的页面(在此示例中:foo.xhtml 具有两个不同的 f 值)。但是只有第一个选项卡突出显示。

<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>

您知道我如何使第二个选项卡按预期工作,即在单击时突出显示吗?

如何设置activeindex? Activeindex 控制突出显示。从 foo.xhtml 正确的 activeindex.

设置到您的 bean