The Java EE 6 Tutorial, Volume I

Using the f:selectItems Tag

The following example from Rendering Components for Selecting Multiple Values shows how to use the h:selectManyCheckbox tag:

<h:selectManyCheckbox
    id="newsletters"
    layout="pageDirection"
    value="#{cashier.newsletters}">
    <f:selectItems
        value="#{newsletters}"/>
</h:selectManyCheckbox>

The value attribute of the f:selectItems tag is bound to the backing bean newsletters , which is configured in the application configuration resource file.

You can also create the list corresponding to a SelectMany or SelectOne component programmatically in the backing bean. See Writing Bean Properties for information on how to write a backing bean property corresponding to a SelectMany or SelectOne component.

The arguments to the SelectItem constructor are as follows:

SelectItems Properties describes in more detail how to write a backing bean property for a SelectItems component.