Implicit Objects

For scripts embedded in a ZUML page, there are a set of implicit objects that enable developers to access components more efficiently. These objects are available to the Java codes included by the zscript element and the attributes for specifying event listeners. They are also available to EL expressions.

For example, self is an instance of org.zkoss.zk.ui.Component to represent the component being processing. In the following example, you could identify the component in an event listener by self.

<button label="Try" onClick="alert(self.label)"/>

Similarly, event is the current event being processed by an event listener. Thus, the above statement is equivalent to

<button label="Try" onClick="alert(event.target.label)"/>