taglib"

From Documentation
m
Line 6: Line 6:
 
</source>
 
</source>
  
This directive is used to load a <tt>taglib</tt> file, which defines a set of static methods that can be used in EL expressions.  
+
This directive is used to load a <tt>taglib</tt> file, which defines a set of static methods that can be used in EL expressions (so called EL functions).  
  
The syntax of a taglib document is described in the subsection:
+
For example, we could load functions defined in the built-in TLD files identified as [[ZUML Reference/EL Expressions/Core Methods|http://www.zkoss.org/dsp/web/core]], and then use [[ZUML Reference/EL Expressions/Core Methods/l|the l function]].
{{ZKDevelopersReferenceHeadingToc}}
 
 
 
In the following example, we loads functions defined in the built-in TLD files identified as [[ZUML Reference/EL Expressions/Core Methods|http://www.zkoss.org/dsp/web/core]], which is the standard methods, and then use the [[ZUML Reference/EL Expressions/Core Methods/l|l function].
 
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 20: Line 17:
 
</source>
 
</source>
  
'''Tip''': ZK searches all TLD files defined in the <tt>/metainfo/tld/config.xml</tt> file from the classpath. If you want ZK to load your custom TLD files, add them to class path and then specify the following content in the <tt>/metainfo/tld/config.xml</tt> file.
+
If you want to load a TLD file from your Web application, you can specify the path directly. For example, suppose you have a custom TLD at <code>/WEB-INF/tld/my.tld</code>, then you could specify it as follows.
<tt>
 
<taglib>
 
    <taglib-uri>http://your-domain.com/your-path</taglib-uri>
 
    <taglib-location>/the/path/of/your/tld/file</taglib-location>
 
</taglib>
 
</tt>
 
 
 
 
 
 
 
If you want to load a TLD file from your Web application, you can specify the path as follows.
 
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 36: Line 23:
 
</source>
 
</source>
  
'''Note'''
+
The syntax of a taglib document is described in the subsection:
: taglib in zk aims to support EL functions only. It can't support tag from other library, such as spring security directly. There is a work around, you may use jsp to use tag from other library, and then use ZK-jsp to use it.
+
{{ZKDevelopersReferenceHeadingToc}}
: Please refer to [http://docs.zkoss.org/wiki/ZK/How-Tos/Concepts-and-Tricks#How_to_access_static_member_field_of_a_class_in_zul_without_zscript How to access static member field of a class in zul without zscript] and [http://docs.zkoss.org/wiki/Integrate_with_JSF%2C_JSP_and_Others Integrate with JSF, JSP and Others]
 
  
 
== uri ==
 
== uri ==

Revision as of 09:49, 15 November 2010


 <?tablib uri="myURI" prefix="my"?>

This directive is used to load a taglib file, which defines a set of static methods that can be used in EL expressions (so called EL functions).

For example, we could load functions defined in the built-in TLD files identified as http://www.zkoss.org/dsp/web/core, and then use the l function.

 <?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
 <window title="${c:l('my.title')}">
 ...
 </window>

If you want to load a TLD file from your Web application, you can specify the path directly. For example, suppose you have a custom TLD at /WEB-INF/tld/my.tld, then you could specify it as follows.

 <?taglib uri="/WEB-INF/tld/my.tld" prefix="my"?>

The syntax of a taglib document is described in the subsection:

Subsections:


uri

[Required][EL is ''not'' allowed]

A URL of the taglib file. Unlike other URL and URI, it doesn't interpret ~ or * specially. And, the page and the taglib files it references must be in the same Web application.

prefix

[Required]

A prefix used to identify functions defined in this taglib file. The prefix could be any non-empty string.

Version History

Version Date Content
     



Last Update : 2010/11/15

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