O'Reilly logo

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

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

Accessing commands via Menubar

Menubar is a horizontal navigation component with drop-down menus that are displayed on mouse over or on clicking. Menubar features the same common behaviors as every PrimeFaces' menu. It consists of (nested) submenus and menu items that can be built declaratively or programmatically by model.

In this recipe, we will build a declarative menu bar with various commands as nested and direct menu items.

How to do it...

We will create a menu bar as shown in the following screenshot:

How to do it...

The following complete code listing shows p:menubar with submenus p:submenu and menu items p:menuitem inside. For instance, the submenu Create ...

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