O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – creating a simple Menu

Let us see how to create a simple Menu in a declarative fashion, by performing the following step:

  1. Create a Menu component using <p:menu> with <p:menuitem> and <p:submenu> to add menuitems and Submenu groups:
    <p:menu>
        <p:menuitem value="System Config" outcome="menu"/>
        <p:submenu label="User Management" >
            <p:menuitem value="View Users" actionListener="#{menuController.showUserManagement()}"/>
            <p:menuitem value="Monitor User Activity" actionListener="#{menuController.showUserActivity()}" ajax="false"/>
        </p:submenu>
        <p:submenu label="Tag Management">
            <p:menuitem value="View Tags" url="menu.jsf"/>
            <p:menuitem value="Tag Statistics" outcome="menu"/>
        </p:submenu>
    </p:menu>

What just happened?

In the preceding code ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required