[play-framework] How to pass an array in the query string

1,230 views
Skip to first unread message

Loai Ghoraba

unread,
May 11, 2010, 3:37:53 PM5/11/10
to play-framework
Hi

I have an action method like this :"public static void associate(Event
event,long[]tasksIds)" that is called using a form and every thing is
fine..

but I want to test something and to do so I need to call this method
via a URL not a form so I just write the path to it:

http://localhost:9000/events/associate?eventId=1&tasksIds=[2,3,5]

but the problem is that when I check the array passed to method (i.e.
via printing it) I always find the array passed is [0], no matter how
I change the query string, tasksIds=[1,6,3] or tasksIds=[2,9,3] or
even tasksIds=[] , in all cases what is passed is an array consisting
of one value only-zero.

so how can I pass array values using query string? again this is just
for some tests I want to do

thanks

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

Loai Ghoraba

unread,
May 11, 2010, 3:40:04 PM5/11/10
to play-framework
correction :the method is "associate(long eventId,long[]tasksIds)"
that is the first parameter is a long not an object..

Chris Reeves

unread,
May 11, 2010, 3:42:21 PM5/11/10
to play-fr...@googlegroups.com
The standard for most web stacks would be
tasksIds=2&tasksIds=9&tasksIds=3. What happens with that?

Thanks, Chris

Loai Ghoraba

unread,
May 11, 2010, 3:54:55 PM5/11/10
to play-framework
This one worked !!! thanks a lot :D

On May 11, 10:42 pm, Chris Reeves <ch...@ev-soft.net> wrote:
> The standard for most web stacks would be
> tasksIds=2&tasksIds=9&tasksIds=3. What happens with that?
>
> Thanks, Chris
>
>
>
>
>
> On Tue, May 11, 2010 at 3:37 PM, Loai Ghoraba <loai1...@gmail.com> wrote:
> > Hi
>
> > I have an action method like this :"public static void associate(Event
> > event,long[]tasksIds)" that is called using a form and every thing is
> > fine..
>
> > but I want to test something and to do so I need to call this method
> > via a URL not a form so I just write the path to it:
>
> >http://localhost:9000/events/associate?eventId=1&tasksIds=[2,3,5]
>
> > but the problem is that when I check the array passed to method (i.e.
> > via printing it) I always find the array passed is [0], no matter how
> > I change the query string, tasksIds=[1,6,3] or tasksIds=[2,9,3] or
> > even tasksIds=[] , in all cases what is passed is an array consisting
> > of one value only-zero.
>
> > so how can I pass array values using query string? again this is just
> > for some tests I want to do
>
> > thanks
>
> > --
> > You received this message because you are subscribed to the Google Groups "play-framework" group.
> > To post to this group, send email to play-fr...@googlegroups.com.
> > To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/play-framework?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/play-framework?hl=en.

Mahmoud Sakr

unread,
May 11, 2010, 4:02:21 PM5/11/10
to play-fr...@googlegroups.com
Another more obvious alternative would be:

?tasksIds[]=2&tasksIds[]=3&tasksIds[]=4

Loai Ghoraba

unread,
May 11, 2010, 4:06:22 PM5/11/10
to play-framework
this one also worked, thanks :D
Reply all
Reply to author
Forward
0 new messages