zk框架window之间传值操作

.zul中向Action传递参数:

 <listcell>
            <button label="修改" onClick="@command('edit',id=each.accountId)" autodisable="self" />
            <button label="删除" onClick="@command('delete',id=each.accountId)" />            
          </listcell>

 Action中接收参数并且打开新的window

@Command
    // 接收参数 .zul中的 @BindingParam("id") String accountId
    public void edit(@BindingParam("id") String accountId) {
        Map<String, String> arg = new HashMap<String, String>();
        arg.put("editFlag", "edit");
        arg.put("accountId", accountId);
        // 传递值
        arg.put("flag", "1");
        // 新创建一个组件,并且传值 map
        Window win = (Window) Executions.getCurrent().createComponents("/person/personEdit.zul", null, arg);
        // 设置关闭按钮
        win.setClosable(true);
        // modal:modal与hightlighted模式基本上是相同的。modal模式下,Window之外的组件是不能够操作的(如下图)。
        win.doModal();
    }


接收来自上一个window的参数

    public AccountVo getEntity() {
        if (entity == null) {
            String flag = (String) Executions.getCurrent().getArg().get("editFlag");
            if (flag.equals("add")) {
                entity = new AccountVo();
            } else {
                /*
                 * 接收来自上一个window的参数
                 */
                String personId = (String) Executions.getCurrent().getArg().get("accountId");
                entity = personService.findById(personId);
            }
        }
        return entity;
    }
原文地址:https://www.cnblogs.com/minotmin/p/3688429.html