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

Choosing a single item with selectOneMenu

The selectOneMenu component is an extended version of JSF selectOneMenu. It provides custom content display along with skinning capabilities.

How to do it…

The simplest component declaration would be as follows:

<p:selectOneMenu>
  <f:selectItem itemLabel="English" itemValue="en"/>
  <f:selectItem itemLabel="Turkish" itemValue="tr"/>
</p:selectOneMenu>

The output visual will be as follows:

How to do it…

There's more...

Instead of working with primitive types or just string literals, most of the time we would be using the selectOneMenu component with domain objects. The basic definition of the component for listing the cars for ...

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