function"
From Documentation
(Created page with '{{ZKDevelopersReferencePageHeader}} '''syntax''' <function class="''foo.MyClass''" singature="''Class1'' ''funcName''(''Class2'' ''arg0'', ''Class3'' ''arg1'')"/> =Version His…') |
|||
Line 2: | Line 2: | ||
'''syntax''' | '''syntax''' | ||
− | <function class="''foo.MyClass''" singature="'' | + | <function class="''foo.MyClass''" singature="''java.lang.String'' ''funcName''(''Class0'', ''Class1'')"/> |
+ | |||
+ | Specifies a static method (aka., a function) that shall be called when a WPD file is interpreted. The returned string will be generated directly to the output. In other words, it must be a valid JavaScript code snippet. | ||
+ | |||
+ | Example, | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <package name="zul.lang" cacheable="false"> | ||
+ | <script src="msgzul*.js"/> | ||
+ | <function class="org.zkoss.zul.impl.Utils" | ||
+ | signature="java.lang.String outLocaleJavaScript()"/> | ||
+ | </package> | ||
+ | </source> | ||
+ | |||
+ | =class= | ||
+ | [Required] | ||
+ | |||
+ | The name of the class where the static method is declared. | ||
+ | |||
+ | =signature= | ||
+ | [Required] | ||
+ | |||
+ | The signature of the static method. The return type has to be a string and the return value shall be a valid JavaScript code snippet. | ||
+ | |||
+ | The method might have arbitrary numbers of arguments. WPD will check the type of each argument and assign a proper value if possible. The following is the type WPD recognized: | ||
+ | |||
+ | {| border='1px' | width="100%" | ||
+ | ! Argument Type !! Value | ||
+ | |- | ||
+ | | javax.servlet.ServletRequest and derives | ||
+ | | The current request. | ||
+ | |- | ||
+ | | javax.servlet.ServletResponse and derives | ||
+ | | The current response. | ||
+ | |- | ||
+ | | javax.servlet.ServletContext | ||
+ | | The current servlet context. | ||
+ | |- | ||
+ | | Others | ||
+ | | null | ||
+ | |} | ||
=Version History= | =Version History= |
Revision as of 02:04, 19 November 2010
syntax
<function class="foo.MyClass" singature="java.lang.String funcName(Class0, Class1)"/>
Specifies a static method (aka., a function) that shall be called when a WPD file is interpreted. The returned string will be generated directly to the output. In other words, it must be a valid JavaScript code snippet.
Example,
<package name="zul.lang" cacheable="false">
<script src="msgzul*.js"/>
<function class="org.zkoss.zul.impl.Utils"
signature="java.lang.String outLocaleJavaScript()"/>
</package>
class
[Required]
The name of the class where the static method is declared.
signature
[Required]
The signature of the static method. The return type has to be a string and the return value shall be a valid JavaScript code snippet.
The method might have arbitrary numbers of arguments. WPD will check the type of each argument and assign a proper value if possible. The following is the type WPD recognized:
Argument Type | Value |
---|---|
javax.servlet.ServletRequest and derives | The current request. |
javax.servlet.ServletResponse and derives | The current response. |
javax.servlet.ServletContext | The current servlet context. |
Others | null |
Version History
Version | Date | Content |
---|---|---|