Page Initialization"
From Documentation
m |
|||
Line 5: | Line 5: | ||
This can be done easily by implementing <javadoc type="interface">org.zkoss.zk.ui.util.Initiator</javadoc>, and then specifying it with [[ZUML Reference/ZUML/Processing Instructions/init|the init directive]]. | This can be done easily by implementing <javadoc type="interface">org.zkoss.zk.ui.util.Initiator</javadoc>, and then specifying it with [[ZUML Reference/ZUML/Processing Instructions/init|the init directive]]. | ||
+ | <source lang="xml"> | ||
<?init class="com.foo.MyInitial"?> | <?init class="com.foo.MyInitial"?> | ||
+ | </source> | ||
<blockquote> | <blockquote> |
Revision as of 06:47, 26 November 2010
Sometimes it is helpful to run some code before ZK Loader instantiates any component. For example, check if the user ha the authority to access, initialize some data, or prepare some variables for EL expressions[1].
This can be done easily by implementing Initiator, and then specifying it with the init directive.
<?init class="com.foo.MyInitial"?>
- ↑ The preparation of variables for EL expression is generally better to be done in the constructor of VariableResolver (and specified with the variable-resolver directive.
Version History
Version | Date | Content |
---|---|---|