Name

<f:selectItem>

Synopsis

This action represents an instance of the component type registered with the type ID javax.faces.SelectItem (by default, an instance of the javax.faces.component.UISelectItem class). The action creates an instance of the component class, configures it based on the action attributes and adds it as a child to the component represented by closest JSF component parent action element.

Syntax

<f:selectItem [id="id"] [binding="componentBinding"]
  [value="value" | 
    itemValue="itemValue" itemLabel="itemLabel" [itemDisabled="true|false"]
    [itemDescription="itemDescription"]
  ]
/>

Attributes

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

id
String

None

The component ID.

itemDescription
String

Any

The item description.

itemDisabled
boolean

Any

Set to true if the item is disabled.

itemLabel
String

Any

The item label.

itemValue
Object

Any

The item value.

value
javax.faces.model.SelectItem

VB

A SelectItem instance containing all model properties.

Example

<h:form>
  <h:selectManyCheckbox value="#{user.projects}">
    <f:selectItem itemValue="JSF" itemValue="1" />
                  <f:selectItem itemValue="JSP" itemValue="2" />
                  <f:selectItem itemValue="Servlets" itemValue="3" />
  </h:selectManyCheckbox>
</h:form>

Get JavaServer Faces now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.