xml <listbox id="userLbx" model="@{userWin.userList}" fixedLayout="true" paginal="@{pagingUser}" selectedItem="@{userWin.user}" onSelect="showUserEdit();"> <listhead> <listheader label="用户名" align="center"></listheader> <listheader label="手机号" align="center"></listheader> <listheader label="分机号" align="center"></listheader> <listheader label="职位" align="center"></listheader> <listheader label="传真" align="center"></listheader> <listheader label="启用状态" align="center"></listheader> </listhead> <listitem self="@{each=user}"> <listcell label="@{user.username}"></listcell> <listcell label="@{user.phone}"></listcell> <listcell label="@{user.exten}"></listcell> <listcell label="@{user.position}"></listcell> <listcell label="@{user.fax}"></listcell> <listcell label="@{user.enabled,converter='com.linktel.linkFax.web.zk.converter.DataConverter'}"></listcell> </listitem> </listbox>
Java package com.linktel.linkFax.web.zk.controller; import java.util.ArrayList; import java.util.List; import org.zkoss.zk.ui.Components; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.SelectEvent; import org.zkoss.zk.ui.ext.AfterCompose; import org.zkoss.zkplus.databind.AnnotateDataBinder; import org.zkoss.zkplus.spring.SpringUtil; import org.zkoss.zul.Window; import org.zkoss.zul.api.Combobox; import org.zkoss.zul.api.Comboitem; import org.zkoss.zul.api.Listbox; import org.zkoss.zul.api.Paging; import org.zkoss.zul.event.PagingEvent; import org.zkoss.zul.event.ZulEvents; import com.linktel.linkFax.LinkFaxContext; import com.linktel.linkFax.dao.support.Page; import com.linktel.linkFax.domain.Company; import com.linktel.linkFax.domain.Dept; import com.linktel.linkFax.domain.User; import com.linktel.linkFax.service.CompanyService; import com.linktel.linkFax.service.DeptService; import com.linktel.linkFax.service.UserService; @SuppressWarnings("serial") public class UserController extends Window implements AfterCompose { protected AnnotateDataBinder binder; private List<User> userList ; // 由于个人失误没添加Get访问器 关键就在于这个 // public List<User> getUserList() { // return userList; // } public void setUserList(List<User> userList) { this.userList = userList; } }
5.0.2 版本的错误
2010-6-4 13:57:45 org.zkoss.zk.ui.impl.UiEngineImpl handleError:1154
严重: >>org.zkoss.zk.ui.UiException: Expects java.util.Set, java.util.List, java.util.Map, Object[], Enum Class, or BindingListModel only. class com.linktel.linkFax.web.zk.controller.UserController
>> at org.zkoss.zkplus.databind.ListModelConverter.coerceToUi(ListModelConverter.java:57)
>> at org.zkoss.zkplus.databind.Binding.myLoadAttribute(Binding.java:366)
>> at org.zkoss.zkplus.databind.Binding.loadAttribute(Binding.java:336)
>> at org.zkoss.zkplus.databind.DataBinder.loadAttrs(DataBinder.java:572)
>> at org.zkoss.zkplus.databind.DataBinder.loadComponent0(DataBinder.java:527)
>> at org.zkoss.zkplus.databind.DataBinder.loadAll(DataBinder.java:556)
3.6.4 版本的错误 (正确)
org.zkoss.zk.ui.UiException: java.lang.NoSuchMethodException: class com.linktel.linkFax.web.zk.controller.IndexController: name=userList args=null
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
org.zkoss.lang.Classes.newInstance(Classes.java:78)
org.zkoss.lang.Exceptions.wrap(Exceptions.java:164)
org.zkoss.zk.ui.UiException$Aide.wrap(UiException.java:46)
org.zkoss.zkplus.databind.DataBinder.fetchValue(DataBinder.java:1005)
org.zkoss.zkplus.databind.DataBinder.myGetBeanWithExpression(DataBinder.java:989)
org.zkoss.zkplus.databind.DataBinder.getBeanAndRegisterBeanSameNodes(DataBinder.java:957)
org.zkoss.zkplus.databind.Binding.loadAttribute(Binding.java:334)
org.zkoss.zkplus.databind.DataBinder.loadAttrs(DataBinder.java:563)
org.zkoss.zkplus.databind.DataBinder.loadComponent0(DataBinder.java:518)
org.zkoss.zkplus.databind.DataBinder.loadAll(DataBinder.java:547)
org.zkoss.zkplus.databind.AnnotateDataBinderInit.doAfterCompose(AnnotateDataBinderInit.java:145)
org.zkoss.zk.ui.impl.RealInits.doAfterCompose(Initiators.java:84)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:384)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:299)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:230)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:166)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)