You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Vishal Popat <vi...@cipriati.co.uk> on 2010/03/17 23:24:28 UTC
URL coding strategies
Hi there, I have a question about URL coding strategies
I have decided to use IndexedParamUrlCodingStrategy for friendly URL's.
I have set PageParameters for this strategy in the following way:
PageParameters pageParameters = new PageParameters();
pageParameters.add("0", categoryName);
pageParameters.add("1", productName);
I have then created a Bookmarkable link like the following:
Link viewItem = new BookmarkablePageLink("viewItem", ProductInfo.class,
pageParameters);
What I really want to do is pass the Product object to the ProductInfo class
without it being visible in the URL.
I would rather not have to query the database for data object that I already
have.
How can this be achieved?
Many thanks in advance.
Regards
Vishal
Re: URL coding strategies
Posted by bgooren <ba...@iswd.nl>.
You cannot have a seo-friendly url _and_ pass objects. If you want to pass an
object to another page (say a Product), then you need to create a
constructor on the target page which accepts a Product or an
IModel<Product>. You can then call setResponsePage( new TargetPage( product
) ); The upside is that you only query the database once for the product,
but the url is not seo-friendly.
vp143 wrote:
>
> Hi there, I have a question about URL coding strategies
>
>
>
> I have decided to use IndexedParamUrlCodingStrategy for friendly URL's.
>
>
>
> I have set PageParameters for this strategy in the following way:
>
>
>
> PageParameters pageParameters = new PageParameters();
>
> pageParameters.add("0", categoryName);
>
> pageParameters.add("1", productName);
>
>
>
> I have then created a Bookmarkable link like the following:
>
> Link viewItem = new BookmarkablePageLink("viewItem", ProductInfo.class,
> pageParameters);
>
>
>
> What I really want to do is pass the Product object to the ProductInfo
> class
> without it being visible in the URL.
>
> I would rather not have to query the database for data object that I
> already
> have.
>
> How can this be achieved?
>
>
>
> Many thanks in advance.
>
>
>
> Regards
>
> Vishal
>
>
>
--
View this message in context: http://old.nabble.com/URL-coding-strategies-tp27939290p27944464.html
Sent from the Wicket - User 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