-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I am brand new to ZK and am getting the following error when accessing my .zul page:
org.zkoss.zk.ui.metainfo.PropertyNotFoundException: Method setRows not found for class com.state.controller.StateListController
This is my .zul page:
<?page title="State List" contentType="text/html;charset=UTF-8"?>
<zk>
<window title="State List" border="normal">
<vbox>
<listbox id="stateList" width="800px" rows="5" use="com.state.controller.StateListController">
<listhead>
<listheader label="State Id" sort="auto" />
<listheader label="State Code" sort="auto" />
<listheader label="State Name" sort="auto" />
</listhead>
</listbox>
</vbox>
</window>
</zk>
What am I doing wrong?
Thanks.
Hey Dorr,
Are you wanting to use MVC pattern? If so then instead of setting the "use" attribute set the "apply" attribute to your controller.
The use attributed is used when you want to extend the functionality of a control :). Please take a look here for more information on the use attribute.
For more MVC information please take a look here.
Thanks. I've got the list displaying, but no data. Below is my .zul and my controller class. It's not going into my controller class.
<?xml version="1.0" encoding="UTF-8"?>
<?page title="State List" contentType="text/html;charset=UTF-8"?>
<zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window id="win" title="State List" width="640px" border="normal" apply="${stateListController}">
<listbox id="list" rows="5">
<listhead>
<listheader label="State Id" sort="auto" />
<listheader label="State Code" sort="auto" />
<listheader label="State Name" sort="auto" />
</listhead>
</listbox>
</window>
</zk>
public class StateListController extends GenericForwardComposer implements ListitemRenderer
{
/**
*
*/
private static final long serialVersionUID = -9063550952204076306L;
/**
*
*/
//private Listbox stateList ;
private IStateMgr stateMgr ;
protected ListModelList listModelList;
protected Listbox list;
public void doAfterCompose(Component comp) throws Exception
{
super.doAfterCompose(comp);
listModelList = new ListModelList();
List<State> states = stateMgr.getAllStates() ;
listModelList.addAll(states);
list.setModel(listModelList);
list.setItemRenderer(this);
}
public void render(Listitem listItem, Object data) throws Exception
{
State state = (State) data;
new Listcell(state.getStateId()+"").setParent(listItem);
new Listcell(state.getStateCde()).setParent(listItem);
new Listcell(state.getStateNameTxt()).setParent(listItem);
}
Asked: 2010-04-04 21:24:32 +0800
Seen: 252 times
Last updated: Apr 08 '10