MenuButton – multiple items in a popup
A menu button is a button that displays multiple menu items in a popup when it is clicked on or pressed. A popup is an absolutely positioned element (overlay) in terms of CSS.
In this recipe, we will learn the structure of p:menuButton
—a JSF tag for the menuButton
component.
How to do it…
The p:menuButton
tag incorporates one or more menu items. The following code snippet demonstrates four menu items that send AJAX and GET requests:
<p:menuButton value="CRUD Operations" iconPos="right"> <p:menuitem value="Save" actionListener="#{menuButtonBean.save}" icon="ui-icon-disk" update="growl"/> <p:menuitem value="Update" actionListener="#{menuButtonBean.update}" icon="ui-icon-arrowrefresh-1-w" update="growl"/> <p:menuitem value="Delete" actionListener="#{menuButtonBean.delete}" icon="ui-icon-close" update="growl"/> <p:separator/> <p:menuitem value="PrimeFaces" url="http://primefaces.org"/>...