The JavaBeans framework provides basic named properties for JavaBean objects. Tapestry extends this from simple properties to property paths.
A property path is a series of property names, separated by periods. When reading a property path, each property is read in series.
In the example from the introduction, the property path visit.userName
was referenced. This path means that the visit
property of the start object (a Tapestry page) should be accessed, then the userName
property of the visit object should
be accessed. This is approximately the same as Java code
getVisit().getUserName()
(except that property access is not typesafe).
In some cases, property paths are used to change a value, instead of reading it. When this occurs, all properties
but the last a read; only the last property is written. In other words, updating visit.userName
would be similar to the JavaCode getVisit().setUserName(
.
value
)
Property paths can be of any length; however, they are just as susceptable to NullPointerException
s
as any other JavaCode. Care must be taken that none of the properties in a property path,
except the final one, return null. This can often be accomplished
using synthesized properties.