Revision history [back]

click to hide/show revision 1
initial version

asked 2009-05-05 07:10:52 +0800

hawk gravatar image hawk

http://hawkphoenix.blogsp... ZK Team

reload browser problem v.s. data binding failed

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

<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;
}

}

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More