evaluator"
Maya001122 (talk | contribs) |
(→name) |
||
(18 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{ZUMLReferencePageHeader}} | |
+ | |||
+ | __TOC__ | ||
+ | |||
+ | '''Syntax:''' | ||
<?evaluator [name="..."] [class="..."] [import="..."]?> | <?evaluator [name="..."] [class="..."] [import="..."]?> | ||
− | |||
It specifies how to evaluate XEL expressions. | It specifies how to evaluate XEL expressions. | ||
− | + | = name = | |
− | + | [Optional][Default: ''none''][Case insensitive] | |
− | [ | ||
− | |||
The name of the implementation used to evaluate the XEL expressions. There are two ways to specify the implementation. One is the name attribute. The other is the class attribute. | The name of the implementation used to evaluate the XEL expressions. There are two ways to specify the implementation. One is the name attribute. The other is the class attribute. | ||
Line 22: | Line 23: | ||
</source> | </source> | ||
− | Here | + | Here is a list of built-in implementations: |
− | |||
− | {| | + | {| class='wikitable' |
! <center>Name</center> | ! <center>Name</center> | ||
! <center>Class / Description</center> | ! <center>Class / Description</center> | ||
Line 33: | Line 33: | ||
| org.zkoss.xel.el.ELFactory | | org.zkoss.xel.el.ELFactory | ||
− | The default implementation. It is based on ZK Commons EL (< | + | The default implementation. It is based on ZK Commons EL (<code>zcommons-el.jar</code>), which is a performance enhancement version of Apache Commons EL. |
+ | |||
+ | |- | ||
+ | | zel | ||
+ | | org.zkoss.xel.zel.ELFactory | ||
+ | |||
+ | The implementation based on The ZK EL Library(<code>zel.jar</code>), which supports new features seen in <i>Unified Expression Language 2.2</i> such as method calls and l-value. | ||
+ | |||
+ | <source lang="xml"> | ||
+ | ''[Since ZK 6, ZK uses this evaluator as the default one.]'' | ||
+ | </source> | ||
|- | |- | ||
Line 59: | Line 69: | ||
| org.zkoss.zkmax.xel.el.ApacheELFactory | | org.zkoss.zkmax.xel.el.ApacheELFactory | ||
− | The implementation that is based on Apache Commons EL, | + | The implementation that is based on Apache Commons EL, org.apache.commons.el.ExpressionEvaluatorImpl. |
<source lang="xml" > | <source lang="xml" > | ||
Line 69: | Line 79: | ||
| org.zkoss.zkmax.xel.el21.ApacheELFactory | | org.zkoss.zkmax.xel.el21.ApacheELFactory | ||
− | The implementation that is based on Apache JSP 2.1 EL, | + | The implementation that is based on Apache JSP 2.1 EL, org.apache.el.ExpressionFactoryImpl. |
<source lang="xml" > | <source lang="xml" > | ||
Line 76: | Line 86: | ||
|} | |} | ||
− | You can provide additional | + | You can provide additional implementation by the use of the <code>class</code> attribute, as described in the following section. The class must implement the <javadoc type="interface">org.zkoss.xel.ExpressionFactory</javadoc> interface. Or, you can specify the following content in <code>metainfo/xel/config.xml</code>. |
<source lang="xml" > | <source lang="xml" > | ||
Line 90: | Line 100: | ||
<references/> | <references/> | ||
− | + | = class = | |
− | + | [Optional][Default: ''dependind on how xel-config is specified''] | |
− | |||
− | |||
− | [Optional][Default: ''dependind on how xel-config is specified''] | ||
− | |||
The implementation used to evaluate the XEL expressions. In addition to the name attribute, you can specify the class directly. For example, you can use MVEL by specifying class as follows. | The implementation used to evaluate the XEL expressions. In addition to the name attribute, you can specify the class directly. For example, you can use MVEL by specifying class as follows. | ||
Line 106: | Line 112: | ||
</source> | </source> | ||
− | + | = import = | |
− | + | [Optiona][Default: ''what are defined in taglib''] | |
− | [Optiona][Default: ''what are defined in taglib''] | ||
− | |||
Specifies a list of classes separated with comma to import for evaluating the expression in this page. For example, with MVEL: | Specifies a list of classes separated with comma to import for evaluating the expression in this page. For example, with MVEL: | ||
Line 122: | Line 126: | ||
</source> | </source> | ||
− | Notice that not all evaluators support the import of classes. For example, all EL-based the evaluators, including the system default one, | + | Notice that not all evaluators support the import of classes. For example, all EL-based the evaluators, including the system default one, do ''not'' support it. In other words, the <code>import</code> attribute is meaningless to them (since they don't have the concept of instantiation). |
+ | |||
+ | In addition, the class's names specified in the import attribute must be a fully qualified name (including the package's name). In other words, it ignores the classes imported by [[ZUML Reference/ZUML/Processing Instructions/import|the import directive]]. | ||
+ | |||
+ | =Version History= | ||
+ | |||
+ | {| border='1px' | width="100%" | ||
+ | ! Version !! Date !! Content | ||
+ | |- | ||
+ | | 6.0.0 | ||
+ | | September 2011 | ||
+ | | Support those new features seen in Unified Expression Language 2.2 such as method calls and l-value. | ||
+ | |} | ||
+ | |||
+ | {{ZUMLReferencePageFooter}} |
Latest revision as of 06:10, 17 May 2022
Syntax:
<?evaluator [name="..."] [class="..."] [import="..."]?>
It specifies how to evaluate XEL expressions.
name
[Optional][Default: none][Case insensitive]
The name of the implementation used to evaluate the XEL expressions. There are two ways to specify the implementation. One is the name attribute. The other is the class attribute.
For example, if you want to use MVEL[1], you can specify the name as follows.
<?evaluator name="mvel"?>
<window id="w" title="MVEL Demo">
${new org.zkoss.zul.Textbox().setParent(w)}
</window>
Here is a list of built-in implementations:
default | org.zkoss.xel.el.ELFactory
The default implementation. It is based on ZK Commons EL ( |
zel | org.zkoss.xel.zel.ELFactory
The implementation based on The ZK EL Library( ''[Since ZK 6, ZK uses this evaluator as the default one.]''
|
mvel | org.zkoss.zkmax.xel.mvel.MVELFactory
The implementation based on MVEL, http://mvel.codehaus.org. ''[available only if zkmax.jar is loaded]''
|
ognl | org.zkoss.zkmax.xel.ognl.OGNLFactory
The implementation based on OGNL, http://www.ognl.org. ''[available only if zkmax.jar is loaded]''
|
commons-el | org.zkoss.zkmax.xel.el.ApacheELFactory
The implementation that is based on Apache Commons EL, org.apache.commons.el.ExpressionEvaluatorImpl. ''[available only if zkmax.jar is loaded]''
|
japser-el | org.zkoss.zkmax.xel.el21.ApacheELFactory
The implementation that is based on Apache JSP 2.1 EL, org.apache.el.ExpressionFactoryImpl. ''[available only if zkmax.jar is loaded]''
|
You can provide additional implementation by the use of the class
attribute, as described in the following section. The class must implement the ExpressionFactory interface. Or, you can specify the following content in metainfo/xel/config.xml
.
<config>
<xel-config>
<evaluator-name>Super</evaluator-name><!-- case insensitive -->
<evaluator-class>my.SuperEvaluator</evaluator-class>
</xel-config>
</config>
Notes
- ↑ MVEL is a powerful expression language. Refer to http://mvel.codehaus.org/ for more information.
class
[Optional][Default: dependind on how xel-config is specified]
The implementation used to evaluate the XEL expressions. In addition to the name attribute, you can specify the class directly. For example, you can use MVEL by specifying class as follows.
<?evaluator class="org.zkoss.zkmax.xel.mvel.MVELFactory"?>
<window id="w" title="MVEL Demo">
${new org.zkoss.zul.Textbox().setParent(w)}
</window>
import
[Optiona][Default: what are defined in taglib]
Specifies a list of classes separated with comma to import for evaluating the expression in this page. For example, with MVEL:
<?evaluator class="org.zkoss.zkmax.xel.mvel.MVELFactory"
import="org.zkoss.zul.Datebox,org.zkoss.zul.Combobox"?>
<window id="w" title="MVEL Demo">
${new Datebox().setParent(w)}
</window>
Notice that not all evaluators support the import of classes. For example, all EL-based the evaluators, including the system default one, do not support it. In other words, the import
attribute is meaningless to them (since they don't have the concept of instantiation).
In addition, the class's names specified in the import attribute must be a fully qualified name (including the package's name). In other words, it ignores the classes imported by the import directive.
Version History
Version | Date | Content |
---|---|---|
6.0.0 | September 2011 | Support those new features seen in Unified Expression Language 2.2 such as method calls and l-value. |