EL Expressions"
From Documentation
m (correct highlight (via JWB)) |
|||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{ZUMLReferencePageHeader}} | {{ZUMLReferencePageHeader}} | ||
− | The syntax of an EL expressions is < | + | The syntax of an EL expressions is <code>${expr}</code>. For example, |
<source lang="xml" > | <source lang="xml" > | ||
Line 9: | Line 9: | ||
</source> | </source> | ||
− | When an EL expression is used as an attribute value, it could return any kind of objects as long as the component accepts it. For example, the following expression will be evaluated | + | When an EL expression is used as an attribute value, it could return any kind of objects as long as the component accepts it. For example, the following expression will be evaluated as a Boolean object. |
<source lang="xml" > | <source lang="xml" > | ||
Line 18: | Line 18: | ||
There are several ways to associate Java objects with EL expressions. | There are several ways to associate Java objects with EL expressions. | ||
# Implement a variable resolver (<javadoc type="interface">org.zkoss.xel.VariableResolver</javadoc>) and specify it with the [[ZUML Reference/ZUML/Processing Instructions/variable-resolver|variable-resolver]] directive. | # Implement a variable resolver (<javadoc type="interface">org.zkoss.xel.VariableResolver</javadoc>) and specify it with the [[ZUML Reference/ZUML/Processing Instructions/variable-resolver|variable-resolver]] directive. | ||
− | # Return the object in a static method and specify it in [[ZUML Reference/ZUML/Processing Instructions/xel-method|xel-method]] | + | # Return the object in a static method and specify it in the [[ZUML Reference/ZUML/Processing Instructions/xel-method|xel-method]] |
# Declare multiple static methods in a taglib and declare it in [[ZUML Reference/ZUML/Processing Instructions/taglib|taglib]] | # Declare multiple static methods in a taglib and declare it in [[ZUML Reference/ZUML/Processing Instructions/taglib|taglib]] | ||
# Construct them in [[ZUML Reference/ZUML/Elements/zscript|zscript]] | # Construct them in [[ZUML Reference/ZUML/Elements/zscript|zscript]] |
Latest revision as of 13:26, 19 January 2022
The syntax of an EL expressions is ${expr}
. For example,
<element attr1="${bean.property}".../>
${map[entry]}
<another-element>${3+counter} is ${empty map}</another-element>
When an EL expression is used as an attribute value, it could return any kind of objects as long as the component accepts it. For example, the following expression will be evaluated as a Boolean object.
<window if="${some > 10}">
Associate with Java
There are several ways to associate Java objects with EL expressions.
- Implement a variable resolver (VariableResolver) and specify it with the variable-resolver directive.
- Return the object in a static method and specify it in the xel-method
- Declare multiple static methods in a taglib and declare it in taglib
- Construct them in zscript
Here is the detailed information for each feature. For introductory, please refer to ZK Developer's Reference.