variables

From Documentation

Stop.png This article is out of date, please refer to ZUML Reference/ZUML/Elements/custom-attributes for more up to date information.

Syntax:

<variables [local="false|true]
var1="value1" [var2="value2"...] [if="if-condition"] [unless="unless-condition"]/>

It defines a set of variables for the ID space it belongs. It is equivalent to the setVariable method of Component, if it has a parent component, and Page, if it is declared at the page level.

You could specify as many as variables you want. These variables are stored to the namespace of the ID space it belongs. Thus, they can be accessible by the interpreters and EL expressions.

 <variables cd="${param.cd}" less="more"/>

local

[Optional][Default: false]

Specifies whether to store the variable always at the current ID space. By default, it is false. It means ZK will check the existence of any variable with the same name by looking up the current ID space, the parent ID space, and parent's parent, and so on. If found, the variable's value is replaced with the value specified here. If not, a local variable is created. If true is specified, it doesn't look up any parent ID space.

composite

[Optional][Default: none]

Specifies the format of the value. It could be none, list or map.

By default, the value is assigned to the variable directly after evaluating EL expressions, if any. For example, "apple, ${more}" is evaluated to "apple, orange", if more is "orange", and assigned to the variable.

If you want to specify a list of values, you can specify the composite attribute with list as follows.

 <variables simple="apple, ${more}" composite="list"/>

Then, it is converted to a list with two elements. The first element is "apple" and the second "orange".

If you want to specify a map of values, you can specify the composite attribute with map as follows.

 <variables simple="juice=apple, flavor=${more}" composite="map"/>

Then, it is converted to a map with two entries. The first entry is ("juice", "apple") and the second ("flavor", "orange").

if

[Optional][Default: true]

Specifies the condition to evaluate this element. This element is ignored if the value specified to this attribute is evaluated to false.

unless

[Optional][Default: false]

Specifies the condition not to evaluate this element. This element is ignored if the value specified to this attribute is evaluated to true.

Version History

Version Date Content
     


Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.