On Tue, Aug 12, 2008 at 10:39 PM, pixologe <[EMAIL PROTECTED]> wrote:
>
> Hi everybody,
>
> AFAIK it is not possible to have a variable nice URL for a page without
> using PageParameters, right?
>
> If I am right: shouldn't it be possible?

no. having a nice/bookmarkble url means having all the state in the
url. this means you can only effectively have state that is composed
of strings, this is what pageparameters does. when this url is invoked
wicket has to figure out how to construct the page object, eg which
constructor to use. that is why we have pageparameters, it helps you
manage the state and help wicket find the right constructor.

> Example: I think it would be cool to be able to do something like this:
> FriendListPage page = new FriendListPage();
> page.setUser("myUsername");
> page.setSorting("asc");
> response.setRedirect(page);
> and have a resulting URL like
> /user/myUsername
> while the sorting is not stored in the URL.

and you can do it like this:
PageParameters params=new PageParameters();
params.set("user","myusername");
params.set("sort","asc");
setresponsepage(mypage.class, params);

you can also encapsulate parameter creation within a page factory
method to make it cleaner

setresponsepage(mypage.class, mypage.params("myusername", "asc"));

-igor




>
> and later (on the page itself - when the user wants to switch sorting):
> FriendlyPage.this.setSorting("desc");
> setResponsePage(FriendlyPage.this);
>
> Would that be feasible?
>
> If there's another way to do it, I would be happy if someone could point it
> out to me...
>
> Thanks a lot :)
> --
> View this message in context: 
> http://www.nabble.com/Pretty-URLs-depending-on-a-Page%27s-state-%28not-params%29-tp18957325p18957325.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to