Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
class MyHomePage extends WebPage {

    public MyHomePage() {
        add(new Link("changeState", new Model()) {
            public void onClick() {
                // this changes link state and therefore page state
                this.setModelObject(new Random().nextInt());
            }
        });

        add(new Link("gotoNewPage") {
            public void onClick() {
                setResponsePage(new MyPageMyHomePage());
            }
        });
    }
}

Now if you go to home page, click once on "gotoNewPage" link, twice on "changeState" link and twice on "gotoNewPage" link again, the page map for the current session will look like this (it doesn't mean page map stores pages in a table or map):

...