Properties Bound to Component Values
Properties Bound to Component Values
The UI component's tag binds the component's value to a property using its value attribute and
binds the component's instance to a property using its binding attribute, as explained in
the converter, listener, and validator tags use their binding attributes to bind their associated
implementations to backing bean properties, as explained in
To bind a component's value to a backing bean property, the type of the property must match
the type of the component's value to which it is bound. For example, if a backing bean property
is bound to a UISelectBoolean component's value, the property should accept and return a
boolean
value or a Boolean wrapper Object instance.
To bind a component instance, the property must match the component type. For example, if a
backing bean property is bound to a UISelectBoolean instance, the property should accept and
return UISelectBoolean.
Similarly, in order to bind a converter, listener, or validator implementation to a property, the
property must accept and return the same type of converter, listener, or validator object. For
example, if you are using the convertDateTime tag to bind a DateTime converter to a property,
that property must accept and return a DateTime instance.
The rest of this section explains how to write properties that can be bound to component values,
to component instances for the component objects described in
, and to converter, listener, and validator
implementations.
Writing Properties Bound to Component Values
To write a backing bean property bound to a component's value, you must know the types that
the component's value can be so that you can make the property match the type of the
component's value.
lists all the component classes described in
and the acceptable types of their values.
When page authors bind components to properties using the value attributes of the
component tags, they need to ensure that the corresponding properties match the types of the
components' values.
Writing Bean Properties
The Java EE 5 Tutorial · September 2007
380