ZK学习笔记
1. zul页面读取国际化资源:
1) 准备资源:i3-label.properties(如果为制定默认该文件)、i3-label_zh_CN.properties(其中i3-label为固定格式),放在WEB-INF目录下;
2) 在zul页面头部添加如下代码
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" ?>3) 使用:
<label value="${c:l('label.system.name')}"/>
import org.zkoss.util.resource.Labels;String str = Labels.getLabel(key);
Locale locale=Locales.getLocale((String)language.getSelectedItem().getValue()); //假如(String)language.getSelectedItem().getValue()为‘zh_CN’session.setAttribute("px_preferred_locale", locale);execution.sendRedirect(execution.getContextPath()+ "/login.zul");
//zul:<window id="win"> <Listbox id="lb"/></window>//java:Component component= Path.getComponent("/win/lb");
Executions.createComponents(newZulUri, parentWin, null);时,parentWin所在zul页面使用了数据绑定功能(当前页没有):
<?init ?>执行时出现异常:
<?init root="./win"?><window id="win">
<system-config> <disable-event-thread>true|false</disable-event-thread></system-config>
Map<String, String> arg = new HashMap<String, String>();arg.put("hostGroupId", hostGroupId);arg.put("hostGroupType", hostGroupType);Window wnd = (Window) Executions.createComponents("/pages/hostMan/hostAdd.zul", null, arg);wnd.doModal();
hostGroupId = (String) Executions.getCurrent().getArg().get("hostGroupId");
Window viewWin = (Window) Executions.createComponents( "pages/reportView.zul", IndexWin.this, argMap);
Map argMap = this.getDesktop().getExecution().getArg();