<parameter> element

Appears in: <component-specification>

Defines a formal parameter of a component. Parameters may be connected (in, form or auto) or unconnected (custom). If a parameter is connected, but the class does not provide the property (or does, but the accessors are abstract), then the framework will create and use a subclass that contains the implementation of the necessary property.

For auto parameters, the framework will create a synthetic property as a wrapper around the binding. Reading the property will read the value from the binding and updating the property will update the binding value. auto may only be used with required parameters. auto is less efficient than in, but can be used even when the component is not rendering.

Figure C.24. <parameter> Attributes

NameTypeRequired ?Default ValueDescription
namestringyes The name of the parameter, which must be a valid Java identifier.
typescalar name, or class nameno Required for connected parameters. Specifies the type of the JavaBean property that a connected parameter writes and reads. The property must match this exact value, which can be a fully specified class name, or the name of a scalar Java type.
requiredyes|nononoIf yes, then the parameter must be bound (though it is possible that the binding's value will still be null).
property-namestringno For connected parameters only; allows the name of the property to differ from the name of the parameter. If not specified, the property name will be the same as the parameter name.
directionin|form|auto|customnocustom

Identifies the semantics of how the parameter is used by the component. custom, the default, means the component explicitly controls reading and writing values through the binding.

in means the property is set from the parameter before the component renders, and is reset back to default value after the component renders.

form means that the property is set from the parameter when the component renders (as with in). When the form is submitted, the value is read from the property and used to set the binding value after the component rewinds.

auto creates a synthetic property that works with the binding to read and update. auto parameters must be required, but can be used even when the component is not rendering.

default-valueOGNL expressionno  Specifies the default value for the parameter, if the parameter is not bound.