23.12.2012 Views

ZK Developer's Guide

ZK Developer's Guide

ZK Developer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Getting Started with <strong>ZK</strong><br />

The second way is to define a zscript for the init sequence:<br />

<br />

Note: It's not necessary to define an init sequence.<br />

Why to use an absolute class name in init?<br />

In the description of the "Page Initial" phase the possibilities for the<br />

definition of the init sequence are shown. The use of org.zkoss.<br />

zk.util.util.Initiator interface to implement it is a good way. In<br />

most cases, the implementation class is placed in some package. To use<br />

the class you have to use the absolute name of the class.<br />

<br />

The reason for this is explained through the lifecycle. If you don't want<br />

to use an absolute class name in a Java program you have to import the<br />

class. In a ZUL file, you can do that with a zscript.<br />

<br />

<br />

However, if you now just use the name InitSample for the init<br />

sequence you will get a java.lang.ClassNotFoundException. To<br />

understand this, just add an output to the zscript.<br />

<br />

<br />

[ 20 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!