Hi,

I use a lot of "anonym-classes-models" which a want to pass to Page instances (no need for be bookmarkable)

class HomePage() {
// some Models here
IModel<Entity> model = new LoadableDetachableModel();

//.... some Buttons-eventhandler
public onClick() {
     IModel<String> m = new AbstractReadOnlyModel<String>() {
            public String getObject() {
                  return "hello page".
            }
     }

     setResponsePage( new HelloPage(m) );
}

//....
public void detach() {
    model.detach();
}

As i discovered now, this seems not to fit conceptually.

1. using anonym model-classes <m> javac always generates a reference to to enclosing class-instance, here <HomePage> 2. during detachment of page <HelloPage> the model <m> will ne detached correctly (clearing transient all objects) 3. after detachment the page <HelloPage> is going to be serialized, which the effect that the reference to the page <HomePage>
   is serialized as well, without detaching thier models.

Are there any "best-practices" related to this issue?
Maybe pushing the <HomePage> on the "page-map-stack" forking <setResponsePage>?

Thanks
Jens Zastrow

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to