You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alec Swan <al...@gmail.com> on 2011/03/09 05:09:22 UTC

Not bookmarkable setResponsePage(new MyPage(pageParameters, extraParam1, extraParam2))

Hello,

I have a form which calls the following statement in its onSubmit() method:

setResponsePage(new MyPage(pageParameters, extraParam1, extraParam2))

NOTE: The MyPage construtor calls WebPage constructor as
super(pageParameters) and then adds extraParam1 and extraParam2 to
WebPage.getPageParameters() map.

The end-result is that a user is redirected to a URL that has no parameters
in it, which means it cannot be bookmarked by the user.

The goal is to have onSubmit() redirect the user to a page that has all
pageParameters encoded in the URL.

What are we doing wrong and what is the recommended way to do this?

Thanks

Re: Not bookmarkable setResponsePage(new MyPage(pageParameters, extraParam1, extraParam2))

Posted by Martijn Dashorst <ma...@gmail.com>.
Wicket only knows how to construct bookmarkable pages when they have
either a default constructor or a constructor taking *only*
pageparameters. Any other constructor is outside the realm of wicket's
capabilities and responsibility.

In your case, how could Wicket construct the page when it is directly
navigated to without going through the form? That is bookmarkability.

The only way is to add those extra parameters to the PageParameters
object and use setResponsePage(MyPage.class, parameters)

Martijn


On Wed, Mar 9, 2011 at 5:09 AM, Alec Swan <al...@gmail.com> wrote:
> Hello,
>
> I have a form which calls the following statement in its onSubmit() method:
>
> setResponsePage(new MyPage(pageParameters, extraParam1, extraParam2))
>
> NOTE: The MyPage construtor calls WebPage constructor as
> super(pageParameters) and then adds extraParam1 and extraParam2 to
> WebPage.getPageParameters() map.
>
> The end-result is that a user is redirected to a URL that has no parameters
> in it, which means it cannot be bookmarked by the user.
>
> The goal is to have onSubmit() redirect the user to a page that has all
> pageParameters encoded in the URL.
>
> What are we doing wrong and what is the recommended way to do this?
>
> Thanks
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

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


Re: Not bookmarkable setResponsePage(new MyPage(pageParameters, extraParam1, extraParam2))

Posted by Igor Vaynberg <ig...@gmail.com>.
you cannot have a bookmarkable url for a page instance, only for a
page class with parameters, so

setResponsePage(MyPage.class, somePageParameters) will give you a
bookmarkable url

-igor

On Tue, Mar 8, 2011 at 8:09 PM, Alec Swan <al...@gmail.com> wrote:
> Hello,
>
> I have a form which calls the following statement in its onSubmit() method:
>
> setResponsePage(new MyPage(pageParameters, extraParam1, extraParam2))
>
> NOTE: The MyPage construtor calls WebPage constructor as
> super(pageParameters) and then adds extraParam1 and extraParam2 to
> WebPage.getPageParameters() map.
>
> The end-result is that a user is redirected to a URL that has no parameters
> in it, which means it cannot be bookmarked by the user.
>
> The goal is to have onSubmit() redirect the user to a page that has all
> pageParameters encoded in the URL.
>
> What are we doing wrong and what is the recommended way to do this?
>
> Thanks
>

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