O'Reilly logo

PrimeFaces Cookbook - Second Edition by Oleg Varaksin, Mert Çalışkan

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

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

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