Name

<f:selectItems>

Synopsis

This action represents an instance of the component type registered with the type ID javax.faces.SelectItems (by default, an instance of the javax.faces.component.UISelectItems 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.

If the value is set to an instance of a class implementing the java.util.Map interface, the keys are used as select item labels and the values as select item values.

Syntax

<f:selectItems [id="id"] [binding="componentBinding"] value="value" />

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.

value

javax.faces.model.SelectItem, an array or Collection with javax.faces.model.SelectItem elements, or a java.util.Map.

VB

One or more SelectItem instances.

Example

<h:form>
  <h:selectManyCheckbox value="#{user.projects}">
    <f:selectItems value="#{allProjects}" />
  </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.