evaluator"

From Documentation
Line 119: Line 119:
 
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 <tt>import</tt> attribute is meaningless to them (since they don't have the concept of instantiation).
 
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 <tt>import</tt> attribute is meaningless to them (since they don't have the concept of instantiation).
  
In additions, 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]].
+
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=
 
=Version History=

Revision as of 07:14, 1 August 2011

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 are a list of built-in implementations.

Name
Class / Description
default org.zkoss.xel.el.ELFactory

The default implementation. It is based on ZK Commons EL (zcommons-el.jar), which is a performance enhancement version of Apache Commons EL.

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 implementations by 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

  1. 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
     



Last Update : 2011/08/01

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