Tag selectItems

Add a child UISelectItems component to the UIComponent associated with the closest parent UIComponent custom action.

When iterating over the select items, toString() must be called on the string rendered attribute values.

Version 2 of the specification introduces several new attributes, described below. These are: var, itemValue, itemLabel, itemDescription, itemDisabled, and itemLabelEscaped.

Tag Information
Tag Classcom.sun.faces.taglib.jsf_core.SelectItemsTag
TagExtraInfo ClassNone
Body Contentempty
Display NameNone

(must evaluate to javax.faces.component.UIComponent)
Value binding expression to a backing bean property bound to the component instance for the UIComponent created by this custom action.
idfalsetruejava.lang.StringComponent identifier of the UISelectItems component to be created.
(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 javax.faces.model.DataModel. The attributes on lines 3 through 9, inclusive, leverage the fact that the value is a collection of POJOs.


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.

(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}.

(must evaluate to java.lang.String)

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

(must evaluate to java.lang.String)

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

(must evaluate to java.lang.Boolean)

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

(must evaluate to java.lang.Boolean)

evaluates to a boolean that will determine if the rendered markup for the item receives normal JSF HTML escaping or not.

(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.

No Variables Defined.

Output Generated by Tag Library Documentation Generator. Java, JSP, and JavaServer Pages are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 2017, Oracle America, Inc. 4150 Network Circle Santa Clara, CA 95054, U.S.A. All Rights Reserved.