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 – displaying an overlay menu with trigger

Let us see how we can create a menu that will be displayed on clicking a button, by performing the following step:

  1. Create an overlay menu and define a trigger component to show it:
    <p:commandButton id="overlayBtn" value="ShowMenu" type="button"/> <p:menu overlay="true" trigger="overlayBtn" my="left top" at="right bottom"> <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"/> ...

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