Hello,

I'm not sure on the answer to your question about the anonymous inner class but in general sharing models between pages can be a bad idea.

The memory issues comes into play if the IModel is like Model and the contained object is not transient (it is serialized as part of the page).

While Pages are serialized each page is serialized independently so on page reload the IModel from the first page is no longer the same object instance as the IModel from the second page. At deserialization time the page1.model.getObject().equals page2.model.getObject() but page1.model.getObject() != page2.model.getObject(); so any changes to either model are not shared between then.

This is not a problem if the model is loadable since the memory of the page it is contained in doesn't matter as the value is loaded from the backend db or some other independent data source like the httpsession, or with wicketApplication.

You can see the same effect if you try and share a model between a panel and a ModelWindow that uses a PageCreator

Hope this helps,

Mike
Hi,

Can someone explain me why it is a memory issue when an instance of an 
anonymous IModel class is passed to another page to be shared, but it seems to 
be no problem when a page reference is passed to another page and is put in an 
instance field (for example to be used in a button to navigate back to previous 
page)?

Many thanks.

Regards,
Rik



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to