You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Fernando Wermus <fe...@gmail.com> on 2010/06/28 21:00:10 UTC
passing a map into PageParameters
Hi all,
I need to pass a map into PageParameters. But I failed.
Map<String, Object> swfParameters=new HashMap<String, Object>();
...
swfParameters.put("token", "abc");
p.put(PanelIframe.SWF_PARAMETERS, swfParameters);
...
RequestCycle.get().urlFor(clazz, p);
The map is converted to "{token=abc}" like.
But when the Page for this request is called, there is an empty map into
PageParameters,
Is there a way to pass a map into PageParameters?
--
Fernando Wermus.
www.linkedin.com/in/fernandowermus
Re: passing a map into PageParameters
Posted by Igor Vaynberg <ig...@gmail.com>.
Page parameters only support strings, so you will have to encode and decode
yourself
-igor
On Jun 29, 2010 9:49 AM, "Fernando Wermus" <fe...@gmail.com>
wrote:
Ray,
I haven't had any succeded either. I am working with fb rest (facebook)
which has some classes that work with json to store several kind of objects.
In my case, I need my page to be bookmarkable.
thanks anyway
On Tue, Jun 29, 2010 at 1:47 AM, Ray Weidner <
ray.weidner.developer@gmail.com> wrote:
> I haven't...
--
Fernando Wermus.
www.linkedin.com/in/fernandowermus
Re: passing a map into PageParameters
Posted by Fernando Wermus <fe...@gmail.com>.
Ray,
I haven't had any succeded either. I am working with fb rest (facebook)
which has some classes that work with json to store several kind of objects.
In my case, I need my page to be bookmarkable.
thanks anyway
On Tue, Jun 29, 2010 at 1:47 AM, Ray Weidner <
ray.weidner.developer@gmail.com> wrote:
> I haven't had any success storing anything other than Strings in
> PageParameters objects. It makes sense, since these are supposed to
> represent bookmarkable (i.e. GET) parameters. If you're hoping to throw
> arbitrary Maps into a PageParameters, you're going to be disappointed. But
> if you have an idea what kind of data is going to be in the Map (especially
> if you're using generics, unlike your example), then you can write a pair
> of
> methods to translate between Map and String for this purpose.
>
> I'm not sure what limitations on characters that you might run into due to
> the fact that they have to be embedded in a URL, so you have to try it out.
> However, I wouldn't be surprised if Wicket escapes everything cleanly,
> meaning that you don't have to worry about such things.
>
> Of course, you don't have to embed your Map within a PageParameters if the
> page that you want to go to doesn't need to be bookmarkable. In that case,
> just pass your Map to the destination page object through a constructor of
> your design, and call #setResponsePage on the page object.
>
>
> On Mon, Jun 28, 2010 at 3:23 PM, Fernando Wermus
> <fe...@gmail.com>wrote:
>
> > This is not what I want to achieve.
> >
> > I need to pass a map of parameters as just an entry into PageParameters
> > and
> > other entries too.
> >
> > For instance,
> >
> >
> > Map swfParameters=new HashMap();
> > swfParameteres.put("a", "1");
> > swfParameteres.put("b", "2");
> >
> > PageParameters p=new PageParameters();
> > p.put("swfParameters", swfParameters);
> > p.put("other", "other");
> >
> > On Mon, Jun 28, 2010 at 4:15 PM, jammyjohn <jc...@yahoo.com>
> wrote:
> >
> > >
> > > PageParameters parameters = new PageParameters(swfParameters);
> > >
> > > This is how the hashmap is constructed in PageParameters..
> > >
> > > Thanks,
> > > J
> > > --
> > > View this message in context:
> > >
> >
> http://apache-wicket.1842946.n4.nabble.com/passing-a-map-into-PageParameters-tp2271341p2271351.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
> > >
> > >
> >
> >
> > --
> > Fernando Wermus.
> >
> > www.linkedin.com/in/fernandowermus
> >
>
--
Fernando Wermus.
www.linkedin.com/in/fernandowermus
Re: passing a map into PageParameters
Posted by Ray Weidner <ra...@gmail.com>.
I haven't had any success storing anything other than Strings in
PageParameters objects. It makes sense, since these are supposed to
represent bookmarkable (i.e. GET) parameters. If you're hoping to throw
arbitrary Maps into a PageParameters, you're going to be disappointed. But
if you have an idea what kind of data is going to be in the Map (especially
if you're using generics, unlike your example), then you can write a pair of
methods to translate between Map and String for this purpose.
I'm not sure what limitations on characters that you might run into due to
the fact that they have to be embedded in a URL, so you have to try it out.
However, I wouldn't be surprised if Wicket escapes everything cleanly,
meaning that you don't have to worry about such things.
Of course, you don't have to embed your Map within a PageParameters if the
page that you want to go to doesn't need to be bookmarkable. In that case,
just pass your Map to the destination page object through a constructor of
your design, and call #setResponsePage on the page object.
On Mon, Jun 28, 2010 at 3:23 PM, Fernando Wermus
<fe...@gmail.com>wrote:
> This is not what I want to achieve.
>
> I need to pass a map of parameters as just an entry into PageParameters
> and
> other entries too.
>
> For instance,
>
>
> Map swfParameters=new HashMap();
> swfParameteres.put("a", "1");
> swfParameteres.put("b", "2");
>
> PageParameters p=new PageParameters();
> p.put("swfParameters", swfParameters);
> p.put("other", "other");
>
> On Mon, Jun 28, 2010 at 4:15 PM, jammyjohn <jc...@yahoo.com> wrote:
>
> >
> > PageParameters parameters = new PageParameters(swfParameters);
> >
> > This is how the hashmap is constructed in PageParameters..
> >
> > Thanks,
> > J
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/passing-a-map-into-PageParameters-tp2271341p2271351.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
> >
> >
>
>
> --
> Fernando Wermus.
>
> www.linkedin.com/in/fernandowermus
>
Re: passing a map into PageParameters
Posted by Fernando Wermus <fe...@gmail.com>.
This is not what I want to achieve.
I need to pass a map of parameters as just an entry into PageParameters and
other entries too.
For instance,
Map swfParameters=new HashMap();
swfParameteres.put("a", "1");
swfParameteres.put("b", "2");
PageParameters p=new PageParameters();
p.put("swfParameters", swfParameters);
p.put("other", "other");
On Mon, Jun 28, 2010 at 4:15 PM, jammyjohn <jc...@yahoo.com> wrote:
>
> PageParameters parameters = new PageParameters(swfParameters);
>
> This is how the hashmap is constructed in PageParameters..
>
> Thanks,
> J
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/passing-a-map-into-PageParameters-tp2271341p2271351.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
>
>
--
Fernando Wermus.
www.linkedin.com/in/fernandowermus
Re: passing a map into PageParameters
Posted by jammyjohn <jc...@yahoo.com>.
PageParameters parameters = new PageParameters(swfParameters);
This is how the hashmap is constructed in PageParameters..
Thanks,
J
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/passing-a-map-into-PageParameters-tp2271341p2271351.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