You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by drf <da...@gmail.com> on 2011/03/10 13:09:34 UTC

Redirecting to another page in a WebPage constructor

In the constructor of a class which extends WebPage, is there a way to
redirect to another page?
setResponsePage() apparently will not work in a constructor.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Redirecting-to-another-page-in-a-WebPage-constructor-tp3345688p3345688.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Redirecting to another page in a WebPage constructor

Posted by vineet semwal <vi...@gmail.com>.
if he actually needs *redirection* then

throw new ImmediateRedirectException(RedirectToPage.class,params);

public class ImmediateRedirectException extends
AbstractRestartResponseException{
    public ImmediateRedirectException(Class<? extends Page>
pageClass,PageParameters params)
    {
        RequestCycle requestCycle=RequestCycle.get();
        requestCycle.setRedirect(true);
        requestCycle.setResponsePage(pageClass, params);
    }

}

On Fri, Mar 11, 2011 at 12:43 PM, Maarten Billemont <lh...@gmail.com> wrote:
> On 10 Mar 2011, at 13:25, vineetsemwal wrote:
>>
>> use restartresponseexception
>
> While drf may not have meant what he said, RestartResponseException will not actually redirect to another page, it will just load the other page as a response to the current page's URL.  That is often very confusing for users, especially when the current page is mounted.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
thank you,

regards,
Vineet Semwal

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


Re: Redirecting to another page in a WebPage constructor

Posted by Maarten Billemont <lh...@gmail.com>.
On 10 Mar 2011, at 13:25, vineetsemwal wrote:
> 
> use restartresponseexception

While drf may not have meant what he said, RestartResponseException will not actually redirect to another page, it will just load the other page as a response to the current page's URL.  That is often very confusing for users, especially when the current page is mounted.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Redirecting to another page in a WebPage constructor

Posted by vineetsemwal <vi...@gmail.com>.
use restartresponseexception

-----
vineet semwal
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Redirecting-to-another-page-in-a-WebPage-constructor-tp3345688p3345714.html
Sent from the Users forum mailing list archive at Nabble.com.

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