background image

UISelectOne Properties

<< UISelectBoolean Properties | UISelectItem Properties >>
<< UISelectBoolean Properties | UISelectItem Properties >>

UISelectOne Properties

value=
"#{cashier.newsletters}">
<f:selectItems value=
"#{newsletters}"/>
</h:selectManyCheckbox>
Here is a bean property that maps to the value of this selectManyCheckbox example:
protected String newsletters[] = new String[0];
public void setNewsletters(String newsletters[]) {
this.newsletters = newsletters;
}
public String[] getNewsletters() {
return this.newsletters;
}
As explained in the section
"Rendering Components for Selecting Multiple Values" on
page 345
, the UISelectItem and UISelectItems components are used to represent all the
values in a UISelectMany component. See
"UISelectItem Properties" on page 385
and
"UISelectItems Properties" on page 385
for information on how to write the bean properties
for the UISelectItem and UISelectItems components.
UISelectOne
Properties
UISelectOne
properties accept the same types as UIInput and UIOutput properties. This is
because a UISelectOne component represents the single selected item from a set of items. This
item can be any of the primitive types and anything else for which you can apply a converter.
Here is the example selectOneMenu tag from
"Displaying a Menu Using the selectOneMenu
Tag" on page 344
:
<h:selectOneMenu
id=
"shippingOption"
required=
"true"
value=
"#{cashier.shippingOption}">
<f:selectItem
itemValue=
"2"
itemLabel=
"#{bundle.QuickShip}"/>
<f:selectItem
itemValue=
"5"
itemLabel=
"#{bundle.NormalShip}"/>
<f:selectItem
itemValue=
"7"
itemLabel=
"#{bundle.SaverShip}"/>
</h:selectOneMenu>
Here is the property corresponding to this tag:
protected String shippingOption =
"2";
public void setShippingOption(String shippingOption) {
Writing Bean Properties
The Java EE 5 Tutorial · September 2007
384