variables"
m |
m (correct highlight (via JWB)) |
||
(4 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{ZUMLReferencePageHeader}} | {{ZUMLReferencePageHeader}} | ||
+ | |||
+ | {{Deprecated | ||
+ | |url=[[ZUML Reference/ZUML/Elements/custom-attributes]] | ||
+ | |}} | ||
__TOC__ | __TOC__ | ||
'''Syntax:''' | '''Syntax:''' | ||
− | + | <variables [local="'''false'''|true] | |
− | <variables [local="false|true] var1="value1" [var2="value2"...]/ | + | ''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 17: | Line 20: | ||
== local == | == 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. | 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 == | == composite == | ||
+ | [Optional][Default: none] | ||
− | + | Specifies the format of the value. It could be <code>none</code>, <code>list</code> or <code>map</code>. | |
− | |||
− | |||
− | |||
− | Specifies the format of the value. It could be < | ||
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 42: | 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" > | ||
Line 51: | Line 48: | ||
== if == | == if == | ||
− | + | [Optional][Default: true] | |
− | |||
− | [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. | Specifies the condition to evaluate this element. This element is ignored if the value specified to this attribute is evaluated to false. | ||
== unless == | == unless == | ||
− | + | [Optional][Default: false] | |
− | |||
− | [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. | Specifies the condition ''not'' to evaluate this element. This element is ignored if the value specified to this attribute is evaluated to true. |
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 |
---|---|---|