f

Tag selectItems

Component Information 
InfoValue
Component Typejakarta.faces.SelectItems
Handler ClassNone
Renderer TypeNone
DescriptionNone
Attributes 
NameRequiredTypeDescription
binding false jakarta.el.ValueExpression
(must evaluate to jakarta.faces.component.UIComponent)

Value binding expression to a backing bean property bound to the component instance for the UIComponent created by this custom action.

idfalsejakarta.el.ValueExpression
(must evaluate to java.lang.String)
Component identifier of the UISelectItems component to be created.
itemDescription false jakarta.el.ValueExpression
(must evaluate to java.lang.String)

evaluates to a String that will serve as the description to be shown for the item.

itemDisabled false jakarta.el.ValueExpression
(must evaluate to java.lang.Boolean)

evaluates to a boolean that will determine if the item value is selectable or not.

itemLabel false jakarta.el.ValueExpression
(must evaluate to java.lang.String)

evaluates to a String that will serve as the label to be shown for the item.

itemLabelEscaped false jakarta.el.ValueExpression
(must evaluate to java.lang.Boolean)

evaluates to a boolean that will determine if the rendered markup for the item receives normal Faces HTML escaping or not. If not specified, the runtime must behave as if the value were true.

itemValue false jakarta.el.ValueExpression
(must evaluate to java.lang.Object)

This attribute lets you refer to a property of the current member of the collection referenced by the "value" attribute, using the value of the "var" attribute as the base. For example, #{n.id}.

noSelectionValue false jakarta.el.ValueExpression
(must evaluate to java.lang.Boolean)

Is either an EL expression pointing to the element in the value collection whose value should be marked as a “no selection” item, or a literal string that exactly matches the value of the item in the collection that must be marked as the “no selection” item. If the user selects such an item and the field is marked as required, then it will not pass validation.

value false jakarta.el.ValueExpression
(must evaluate to java.lang.Object)

Value expression pointing at any Collection or array. The member elements may be instances of SelectItem or any Java Object. In the case where the member elements are plain Java Objects, several additional attributes must be used by the page author to correctly identify the data to the enclosing UISelectOne or UISelectMany component, as shown in the following example.

  1. <h:selectOneListbox size="1" id="escape02" value="#{select05NoSelection.initialCollectionValues}">
  2.   <f:selectItems value="#{select05NoSelection.hobbitList}"
  3.                  var="n"
  4.                  itemValue="#{n.id}"
  5.                  itemLabel="#{n.bio}"
  6.                  itemDescription="#{n.description}"
  7.                  itemDisabled="#{n.disabled}"
  8.                  itemLabelEscaped="true"
  9.                  noSelectionValue="#{select05NoSelection.hobbitList[0]}"/>
  10. </h:selectOneListbox>

In the preceding example, the value attribute on line 1 points to a Collection<HobbitBean>. HobbitBean is just a regular Java Object (POJO) that conforms to JavaBeans naming conventions for its properties. The value attribute on line 2 points to a List<HobbitBean>, though it could just as well point to a Collection, array, or jakarta.faces.model.DataModel. The attributes on lines 3 through 9, inclusive, leverage the fact that the value is a collection of POJOs.

varfalsejakarta.el.ValueExpression
(must evaluate to java.lang.String)

Expose the value from the value attribute under this request scoped key so that it may be referred to in EL for the value of other attributes.