Target: A method's parameter (initial method and command method)

Purpose: Tell binder to retrieve this parameter with specified key from the current execution's attribute.

The annotation is applied to initial (or command) method's parameter. It declares that the applied parameter should come from the current execution's attribute with specified key.


Assume we want to pass an object by execution's attribute to an included ZUL that uses a ViewModel: ExecutionParamVM.

outer ZUL

<window id="w2">
        void doClick() {
            org.zkoss.zk.ui.Execution ex = org.zkoss.zk.ui.Executions.getCurrent();
            ex.setAttribute("param1", "abc");
            inc.src = "executionparam-inner.zul";
    <button label="do include" onClick="doClick()"/>
    <include id="inc"/>

We use annotation to retrieve execution's attribute with key "param1".

public class ExecutionParamVM {
    private String param1;

    public void init(@ExecutionParam("param1") String param1) {
        this.param1 = param1;
    // setter, getter, and others


    <vbox apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('foo.ExecutionParamVM')">
        <label value="@load(vm.param1)"/>
  • The label will display "abc".