-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have a problem which is similar with this post:
http://www.zk1.org/forum/index.zul#path%3DlistComment%3BdiscussionId%3D6909%3BcategoryId%3D14%3B
I apply the solution, change my composer from singleton spring bean to "prototype".
but I found my listbox with annotation data binding failed, it always get null.
I initilize all data in composer's doAfterCompose(Component comp).
I have found the listbox might get data from different composer bean by tracing the code.
and after I change back my bean to "singleton", the listbox will get the data successfully.
But this way will suffer "the reload browser problem",
that means if you reload the browser, that page will show the error:
You cannot access components belong to other desktop
org.zkoss.zk.ui.UiException: You cannot access components belong to other desktop
at org.zkoss.zk.ui.AbstractComponent.checkDetach(AbstractComponent.java:508)
...
that page with this exception can not be displayed even you logout and login again.
Do anyone know how to deal with it? thanks.
The following brief describe the related page and code:
rentingListbox is a self-defined class which inherit ZK's Listbox.
.zul page
<?page title="" contentType="text/html;charset=UTF-8"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<zk>
<window id="win" apply="${rentComposer}">
<listbox id="rentingListbox" use="RentingListbox">
<listhead sizable="true">
<listheader label="a" width="30px" />
<listheader label="b" />
<listheader label="c" width="60px" />
<listheader label="d" width="380px" />
<listheader label="e" width="180px" />
</listhead>
</listbox>
<listbox id="myRentListbox" model="@{rentComposer.myRentRecord}">
<listhead sizable="true">
<listheader label="1" width="30px" visible="false"/>
<listheader label="2" />
<listheader label="3" width="60px" />
<listheader label="4" width="180px" />
<listheader label="5" />
</listhead>
...
</listbox>
</window>
</zk>
public class RentComposer extends GenericAutowireComposer {
public void doAfterCompose(Component comp) throws Exception {
//initialize myRentRecord
}
public List<RentRecord> getMyRentRecord() {
return myRentRecord;
}
public void setMyRentRecord(List<RentRecord> myRentRecord) {
this.myRentRecord = myRentRecord;
}
}
Hi!!.... I've solved my problem :D
I had my controller definition like the following:
<window id="win" width="1845px" apply="${sessionScope.myBean}">
and I changed it by:
<zscript> <![CDATA[ import com.domain.bean.MyBean; MyBean myBean = new MtBean(); ]]> </zscript> <window id="win" width="1845px" apply="${myBean}">
Because at session initialization
apply="${sessionScope.myBean}"
But I see you are using Spring right?:
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
Regards.
Asked: 2009-05-05 07:10:52 +0800
Seen: 636 times
Last updated: Oct 28 '11