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