EL Expressions"

From Documentation
(Created page with '{{ZUMLReferencePageHeader}} This chapter describes the details about applying EL expressions to ZUML pages. {{ZUMLReferenceHeadingToc}} {{ZUMLReferencePageFooter}}')
 
m
Line 1: Line 1:
 
{{ZUMLReferencePageHeader}}
 
{{ZUMLReferencePageHeader}}
  
This chapter describes the details about applying EL expressions to ZUML pages.  
+
EL expressions use the syntax <tt>${expr}</tt>. For example,
 +
 
 +
<source lang="xml" >
 +
<element attr1=」${bean.property}」.../>
 +
${map[entry]}
 +
<another-element>${3+counter} is ${empty map}</another-element>
 +
</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 to a Boolean object.
 +
 
 +
<source lang="xml" >
 +
<window if="${some > 10}">
 +
</source>
 +
 
 +
=Associate with Java=
 +
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.
 +
# Return the object in a static method and specify it in [[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]]
 +
# Construct them in [[ZUML Reference/ZUML/Elements/zscript|zscript]]
 +
 
 +
Here is the detailed information for each feature. For introductory, please refer to [[ZK Developer's Reference/UI Composing/ZUML/EL Expressions|ZK Developer's Reference]].
  
 
{{ZUMLReferenceHeadingToc}}
 
{{ZUMLReferenceHeadingToc}}
 
{{ZUMLReferencePageFooter}}
 
{{ZUMLReferencePageFooter}}

Revision as of 11:02, 24 November 2010


EL Expressions


EL expressions use the syntax ${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 to a Boolean object.

 <window if="${some > 10}">

Associate with Java

There are several ways to associate Java objects with EL expressions.

  1. Implement a variable resolver (VariableResolver) and specify it with the variable-resolver directive.
  2. Return the object in a static method and specify it in xel-method
  3. Declare multiple static methods in a taglib and declare it in taglib
  4. Construct them in zscript

Here is the detailed information for each feature. For introductory, please refer to ZK Developer's Reference.




Last Update : 2010/11/24

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