<property-specification> element

Appears in: <component-specification>, <page-specification>

Defines a transient or persistent property to be added to the page or component. Tapestry will create a subclass of the page or component class (at runtime) and add the necessary fields and accessor methods, as well as end-of-request cleanup.

It is acceptible for a page (or component) to be abstract, and have abstract accessor methods matching the names that Tapestry will generate for the subclass. This can be useful when setting properties of the page (or component) from a listener method.

A connected parameter specified in a <parameter> element may also cause an enhanced subclass to be created.

An initial value may be specified as either the initial-value attribute, or as the body of the <property-specification> element itself.

Figure C.27. <property-specification> Attributes

NameTypeRequired ?Default ValueDescription
namestringyes The name of the property to create.
typestringnojava.lang.Object The type of the property. If abstract accessors exist, they must exactly match this type. The type may be either a fully qualified class name, or the name of one of the basic scalar types (int, boolean, etc.). It may be suffixed with [] to indicate an array of the indicated type.
persistentyes|nonono If true, the generated property will be persistent, firing change notifications when it is updated.
initial-valuestringno  An optional OGNL expression used to initialize the property. The expression is evaluated only when the page is first constructed.