Interface ExecutionInit

All Known Implementing Classes:
HibernateSessionContextListener, OpenEntityManagerInViewListener, OpenSessionInViewListener

public interface ExecutionInit

Used to initialize an execution when it is created.

How this interface is used.

  1. First, you specify a class that implements this interface in WEB-INF/zk.xml as a listener.
  2. Then, even time ZK loader creates a new execution, an instance of the specified class is instantiated and init(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution) is called.


Method Summary
 void init(Execution exec, Execution parent)
          Called when an execution is created and initialized.

Method Detail


void init(Execution exec,
          Execution parent)
          throws java.lang.Exception
Called when an execution is created and initialized.

Note: this method is called after exec is activated. In other words, Executions.getCurrent() is the same as the exec argument.

When this method is called, you can retrieve the current page with ExecutionCtrl.getCurrentPage(). However, the page is not initialized yet. In other words, Page.getDesktop(), Page.getId() and Page.getTitle() all return null. To get the current desktop, you have to use Execution.getDesktop() (from Executions.getCurrent()) instead. On the other hand, you can set the page's ID, title or style in this method (to override the declarations in the page definition) by Page.setId(java.lang.String), Page.setTitle(java.lang.String) and Page.setStyle(java.lang.String). In additions, Page.getRequestPath() and Page.getAttribute(java.lang.String, int) are all available.

exec - the execution being created.
parent - the previous execution in the same (Servlet) request, or null if this is the first execution of the request.

Copyright © 2005-2011 Potix Corporation. All Rights Reserved. Logo