component"

From Documentation
m (correct highlight (via JWB))
 
(One intermediate revision by one other user not shown)
Line 13: Line 13:
  
 
'''Syntax'''
 
'''Syntax'''
<source lang="xml">
+
  <zk:component name="''componentName''" macroURI="''/mypath/my.zul''" inline="true"
  <zk:component name="componentName" macroURI="/mypath/my.zul" inline="true"
+
   [''prop1''="''value1''"] [''prop2''="''value2''"].../>
   [prop1="value1"] [prop2="value2"].../>
 
</source>
 
  
 
By specifying <code>inline="true"</code>, we could define an inline macro which will inline-expends the macro template (specified in macroURI) when it is used. In other words, it works as if you copy the content from the template directly to the target document.
 
By specifying <code>inline="true"</code>, we could define an inline macro which will inline-expends the macro template (specified in macroURI) when it is used. In other words, it works as if you copy the content from the template directly to the target document.
Line 22: Line 20:
 
=Use New Defined Components=
 
=Use New Defined Components=
  
Due to the limitation of JSP, we cannot declare a new JSP tag dynamically. In other words, we can not specify the name of the new defined component directly. Thus, we introduce a special tag called <tt>ui</tt> that has a special attribute called <tt>tag</tt> to allow us to specify the component's name. For example:
+
Due to the limitation of JSP, we cannot declare a new JSP tag dynamically. In other words, we can not specify the name of the new defined component directly. Thus, we introduce a special tag called <code>ui</code> that has a special attribute called <code>tag</code> to allow us to specify the component's name. For example:
  
<source lang="xml" high="1,4">
+
<source lang="xml" highlight="1,4">
 
<zk:component name="username" inline="true" macroURI="/macro/username.zul">
 
<zk:component name="username" inline="true" macroURI="/macro/username.zul">
 
...
 
...
Line 33: Line 31:
 
</source>
 
</source>
  
As shown, the <tt>tag</tt> attribute specifies the name of the component defined in this JSP document.
+
As shown, the <code>tag</code> attribute specifies the name of the component defined in this JSP document.
  
 
=Version History=
 
=Version History=

Latest revision as of 12:40, 19 January 2022


Component

Syntax

<zk:component name="componentName" [class="myPackage.myClass"]
    [extends="existentJavaClassName"] [moldName="myMoldName"] [moldURI="myMoldURI"]
    [prop1="value1"] [prop2="value2"].../>

It defines a new kind of component tag, which could be used in the JSP document. If the class attribute is declared, the class must implement Component.

Inline Macro Definition

Syntax

<zk:component name="componentName" macroURI="/mypath/my.zul" inline="true"
 [prop1="value1"] [prop2="value2"].../>

By specifying inline="true", we could define an inline macro which will inline-expends the macro template (specified in macroURI) when it is used. In other words, it works as if you copy the content from the template directly to the target document.

Use New Defined Components

Due to the limitation of JSP, we cannot declare a new JSP tag dynamically. In other words, we can not specify the name of the new defined component directly. Thus, we introduce a special tag called ui that has a special attribute called tag to allow us to specify the component's name. For example:

<zk:component name="username" inline="true" macroURI="/macro/username.zul">
...
<zk:page>
  <zk:ui tag="username" who="ZK User"/>
    
</zk:page>

As shown, the tag attribute specifies the name of the component defined in this JSP document.

Version History

Last Update : 2022/01/19


Version Date Content
     


Last Update : 2022/01/19

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