howzat wrote:
> Page A has this code in its constructor:
>               Link b = new Link("b"){
>                       public void onClick(){
>                              setResponsePage(B.class);
>                         }
>               };
>               add(b);

This will always create a new instance of B when clicked.

If you wish to use a particular page instance, you need to pass it
around. You can do this in the constructors if you like.

public MyPage() {
    this(null);
}

public MyPage(final Page pageToReturnTo) {
    //...
    Link foo = new Link("foo"){
        public void onClick() {
            if (pageToReturnTo != null) {
                setResponsePage(pageToReturnTo);
            }
            else {
                setResponsePage(OtherPage.class);
            }
        }
    }
}

Regards,

Al

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to