variables"
m (correct highlight (via JWB)) |
|||
Line 11: | Line 11: | ||
''var1''="''value1''" [''var2''="''value2''"...] [if="''if-condition''"] [unless="''unless-condition''"]/> | ''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 < | + | It defines a set of variables for the ID space it belongs. It is equivalent to the <code>setVariable</code> method of <code>Component</code>, if it has a parent component, and <code>Page</code>, 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. | 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. | ||
Line 27: | Line 27: | ||
[Optional][Default: none] | [Optional][Default: none] | ||
− | Specifies the format of the value. It could be < | + | Specifies the format of the value. It could be <code>none</code>, <code>list</code> or <code>map</code>. |
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. | 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 < | + | If you want to specify a list of values, you can specify the <code>composite</code> attribute with <code>list</code> as follows. |
<source lang="xml" > | <source lang="xml" > | ||
Line 39: | Line 39: | ||
Then, it is converted to a list with two elements. The first element is "apple" and the second "orange". | 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 < | + | If you want to specify a map of values, you can specify the <code>composite</code> attribute with <code>map</code> as follows. |
<source lang="xml" > | <source lang="xml" > |
Latest revision as of 13:27, 19 January 2022
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 |
---|---|---|