Tuesday, May 22, 2007

Some common component properties

Most components support a certain common set of properties. Among them are 'value', and 'binding'.

value - The component's current local value. Can be literal text or a value binding expression
binding - A value binding expression that associates this component to a backing bean property

If the 'value' property is a value binding expression, the value entered by the user in an input component will also be updated in the appropriate backing bean property, if the value passes all validations.

On first glance, the difference between 'value', and 'binding' is not very clear. I think (need to verify), 'value' (when used with a value binding expr) is used to transfer the user's input into a backing bean property, whereas 'binding' is used to associate a component with a backing bean property so that the backing bean can manipulate the component within code (Hence the type of the backing bean property must be the same as the type of the component).

No comments: