The zscript-config Element"

From Documentation
m (correct highlight (via JWB))
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
It configures the interpreters to interpret the zscript codes. The allowed child element is <tt>language-name</tt> and <tt>interpreter-class</tt>. You might have multiple <tt>zscript-config</tt> elements in one <tt>zk.xml</tt>.
+
{{ZKConfigurationReferencePageHeader}}
 +
 
 +
'''Syntax:'''
 +
<zscript-config>
 +
    <language-name>''a_programming_language''</language-name><!-- case insensitive -->
 +
    <interpreter-class>''a_class_name''</interpreter-class>
 +
</zscript-config>
 +
 
 +
[Optional]
 +
 
 +
Specifies an interpreter to interpret the [[ZUML Reference/ZUML/Elements/zscript|zscript]] code. The allowed child element is <code>language-name</code> and <code>interpreter-class</code>. You might have multiple <code>zscript-config</code> elements in one <code>zk.xml</code>.
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 8: Line 18:
 
</source>
 
</source>
  
'''Note:''' Unlike most other configurations defined in <tt>WEB-INF/zk.xml</tt>, the definitions defined in <tt>zscript-config</tt> are applied to all Web applications sharing the same <tt>zk.jar</tt>.
+
'''Note:''' Unlike most other configurations defined in <code>WEB-INF/zk.xml</code>, the definitions defined in <code>zscript-config</code> are applied to all Web applications sharing the same <code>zk.jar</code>.
  
In other words, the scripting language defined here are visible to all Web applications sharing the same <tt>zk.jar</tt>. Furthermore, it may cause errors in another Web application, if the classes or resources are available only in the Web application defining this.
+
In other words, the scripting language defined here are visible to all Web applications sharing the same <code>zk.jar</code>. Furthermore, it may cause errors in another Web application, if the classes or resources are available only in the Web application defining this.
  
Thus, if it is an issue, just put <tt>zk.jar</tt> and relevant ZK libraries under the <tt>WEB-INF/lib</tt> directory.
+
Thus, if it is an issue, just put <code>zk.jar</code> and relevant ZK libraries under the <code>WEB-INF/lib</code> directory.
  
=== The language-name Element ===
+
== The language-name Element ==
 
  [Required]
 
  [Required]
  
 
It specifies the language name. It is case insensitive. The previous implementation with the same language name will be replaced if any.
 
It specifies the language name. It is case insensitive. The previous implementation with the same language name will be replaced if any.
  
=== The interpreter-class Element ===
+
== The interpreter-class Element ==
 
  [Required]
 
  [Required]
  
 
It specifies the implementation class. It must implement the <javadoc type="interface">org.zkoss.zk.scripting.Interpreter</javadoc> interface. Instead of implementing it from scratch, you can derive from the <javadoc>org.zkoss.zk.scripting.util.GenericInterpreter</javadoc> class. If you want to support the hierarchical scopes (i.e., one interpreter scope per namespace), it can also implement the <javadoc type="interface">org.zkoss.zk.scripting.HierachicalAware</javadoc> interface.
 
It specifies the implementation class. It must implement the <javadoc type="interface">org.zkoss.zk.scripting.Interpreter</javadoc> interface. Instead of implementing it from scratch, you can derive from the <javadoc>org.zkoss.zk.scripting.util.GenericInterpreter</javadoc> class. If you want to support the hierarchical scopes (i.e., one interpreter scope per namespace), it can also implement the <javadoc type="interface">org.zkoss.zk.scripting.HierachicalAware</javadoc> interface.
 +
 +
==Version History==
 +
 +
{| border='1px' | width="100%"
 +
! Version !! Date !! Content
 +
|-
 +
| &nbsp;
 +
| &nbsp;
 +
| &nbsp;
 +
|}
 +
 +
{{ZKConfigurationReferencePageFooter}}

Latest revision as of 10:34, 19 January 2022


The zscript-config Element


Syntax:

<zscript-config>
    <language-name>a_programming_language</language-name>
    <interpreter-class>a_class_name</interpreter-class>
</zscript-config>
[Optional]

Specifies an interpreter to interpret the zscript code. The allowed child element is language-name and interpreter-class. You might have multiple zscript-config elements in one zk.xml.

 <zscript-config>
     <language-name>Java</language-name><!-- case insensitive -->
     <interpreter-class>my.MySuperJavaInterpreter</interpreter-class>
 </zscript-config>

Note: Unlike most other configurations defined in WEB-INF/zk.xml, the definitions defined in zscript-config are applied to all Web applications sharing the same zk.jar.

In other words, the scripting language defined here are visible to all Web applications sharing the same zk.jar. Furthermore, it may cause errors in another Web application, if the classes or resources are available only in the Web application defining this.

Thus, if it is an issue, just put zk.jar and relevant ZK libraries under the WEB-INF/lib directory.

The language-name Element

[Required]

It specifies the language name. It is case insensitive. The previous implementation with the same language name will be replaced if any.

The interpreter-class Element

[Required]

It specifies the implementation class. It must implement the Interpreter interface. Instead of implementing it from scratch, you can derive from the GenericInterpreter class. If you want to support the hierarchical scopes (i.e., one interpreter scope per namespace), it can also implement the HierachicalAware interface.

Version History

Version Date Content
     



Last Update : 2022/01/19

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