background image

UISelectItem Properties

<< UISelectOne Properties | Properties for SelectItems >>
<< UISelectOne Properties | Properties for SelectItems >>

UISelectItem Properties

this.shippingOption = shippingOption;
}
public String getShippingOption() {
return this.shippingOption;
}
Note that shippingOption represents the currently selected item from the list of items in the
UISelectOne
component.
As explained in the section
"Displaying a Menu Using the selectOneMenu Tag" on page 344
, the
UISelectItem
and UISelectItems components are used to represent all the values in a
UISelectOne
component. See
"UISelectItem Properties" on page 385
and
"UISelectItems
Properties" on page 385
for information on how to write the backing bean properties for the
UISelectItem
and UISelectItems components.
UISelectItem
Properties
A UISelectItem component represents one value in a set of values in a UISelectMany or
UISelectOne
component. The backing bean property that a UISelectItem component is
bound to must be of type SelectItem. A SelectItem object is composed of an Object
representing the value, along with two Strings representing the label and description of the
SelectItem
object.
The Duke's Bookstore application does not use any UISelectItem components whose values
are bound to backing beans. The example selectOneMenu tag from
"Displaying a Menu Using
the selectOneMenu Tag" on page 344
contains selectItem tags that set the values of the list of
items in the page. Here is an example bean property that can set the values for this list in the
bean:
SelectItem itemOne = null;
SelectItem getItemOne(){
return itemOne;
}
void setItemOne(SelectItem item) {
itemOne = item;
}
UISelectItems
Properties
UISelectItems
components are children of UISelectMany and UISelectOne components.
Each UISelectItems component is composed of either a set of SelectItem instances or a set of
SelectItemGroup
instances. As described in
"Using the selectItems Tag" on page 347
, a
SelectItemGroup
is composed of a set of SelectItem instances. This section describes how to
write the properties for selectItems tags containing SelectItem instances and for
selectItems
tags containing SelectItemGroup instances.
Writing Bean Properties
Chapter 12 · Developing with JavaServer Faces Technology
385