0

Just a little question. How can I implements a double redirect between three page?

Es.

    public class A extends BasePage{

    public A() {
        super("A");
        setResponsePage(new B());
    }

}

public class B extends BasePage{

    public B() {
        super("B");
        setResponsePage(new C());
    }

}

Wicket just stop at Page B without redirect to page C.

Don't ask why I have to do this this. I only need to know if is possibile even not using setResponsePage.

Thanks

MrMime
  • 665
  • 4
  • 10
  • 24

1 Answers1

2

Wicket will use the last executed setResponsePage() to determine its redirect-page. In your case, that's setResponsePage(new B()) and not setResponsePage(new C()). Indeed, the latter is executed while constructing B.

If you would do

public class A extends BasePage{

    public A() {
        super("A");
        B pageB = new B();
        setResponsePage(pageB);
        pageB.init();
    }

}

public class B extends BasePage{

    public B() {
        super("B");
    }

    public init() {
        setResponsePage(new C());
    }

}

it should work, and you would get a redirect to C!

Willem Mulder
  • 12,974
  • 3
  • 37
  • 62
  • It works very well but I have a question. Wich page flow wins? What happen to page B? – MrMime Jun 07 '12 at 13:30
  • Nothing really 'happens' to page B. It just gets created, like C. Because C is the page that Wicket will return to the browser, C is also rendered, and page B is not..! – Willem Mulder Jun 07 '12 at 13:43