Eccles has properties, like variables in a proper language. It is important to realise that these have their own scoping
rules (again like proper languages). But first lets see a snippet of how we use them
<test id="main">
<log message="Hello World!!!"/>
<property define="aProperty" value="55"/>
<log message="value is ${aProperty}"/>
<property set="aProperty" value="hello"/>
<log message="value is now ${aProperty}"/>
</test>
Ignore the syntax of the log
tag, I'll deal with that in the next section.
As you can see, the property
tag has two different meanings. If you use it with the define=
property then
you are bringing a new property into existance at the current level. It will exist for the rest of the lifetime of the parent tag.
When used with set=
, the value for that property will be changed. The property does not have to be defined
in the current scope, it can be wherever the property is in scope. And before you ask, that can be anywhere in the parent list of tags (or in a sibling tag after a property define)
When using the value=
attribute, the property is assigned a string value. There are other attributes for
other types you may need, which are intValue=, longValue=, doubleValue=
and booleanValue=
.
See the property
tag documentation for more information.
NOTE: Currently, only top level property names are supported in set=
. This will be extended at
some time to support sub-properties and indexing. (note this means you cannot use set="bean.property"
)