this is not really solveable by wicket itself.
We don't know where such a reference is comming from, so this should be
documented i guess
that if you use session data from the session object itself. You should
always use an extra
indiretion to get it
new Model()
{
 getObject() {Session.get().getList()}
}

johan


On 7/10/07, Martijn Dashorst <[EMAIL PROTECTED]> wrote:

Working on the Book I found a difference between 1.2 and 1.3:

In the following setup if you click on the 'link' a couple of times,
you see that the list in the session grows, and that it is reflected
in each page render.

Now, press the back button and continue clicking on the link. You will
see that the page remains static from that moment on. This was not a
problem in 1.2 because the HttpSessionStore is the only way of storing
the pages for back button behavior. However, in 1.3 the 2nd level
cache is the new way of storing, and this is the consequence of that
store: you get different objects between versions.

Is there anything we can do to prevent this from happening?

public class MySession extends WebSession {
    public final List<String> list = new ArrayList<String>();
}

public class FooPage extends WebPage {
    public FooPage() {
        add(new ListView("foo", MySession.get().list){
            protected void populateItem(ListItem item) {
                item.add(new Label("text", item.getModelObject()));
            }
        });
        add(new Link("link") {
            protected void onClick() {
                MySession.get().list.add("foo " + System.currentTimeMillis
());
            }
        });
    }
}

<html>
<body>
<ul>
<li wicket:id="foo"><span wicket:id="text"></span></li>
</ul>
<a href="#" wicket:id="link">Click me</a>
</body>
</html>


--
Wicket joins the Apache Software Foundation as Apache Wicket
Apache Wicket 1.3.0-beta2 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta2/

Reply via email to