Routes pattern to be specified when more than one URL param in GET request

138 views
Skip to first unread message

gokool

unread,
Sep 30, 2012, 7:55:42 PM9/30/12
to play-fr...@googlegroups.com
I am trying to figure out how to specify multiple URL parameters in the routes file and associated Controller method.
For eg. the GET request I want to send to the Controller is like this:

http://localhost:9000/search?name=Groceries&loc=Fairfax

I expressed this in the routes file as :
GET        /search?{name}&{loc}                        Application.search

However, nothing happens when this is invoked and all I see in the server console is :
16:48:58,363 WARN  ~ Ignoring name,loc (static params must be specified as key:'value',...)
16:48:58,375 WARN  ~ Ignoring name,loc (static params must be specified as key:'value',...)

Any idea what the correct way to specify multiple URL params is? I checked the documentation but that has examples with only one param.

I am guessing that once the routes file is specified correctly, I can access the param values in the controller using the construct  params.get("name") .

Regards
Gokul

Regards
Gokul

Sean Brady

unread,
Sep 30, 2012, 8:01:03 PM9/30/12
to <play-framework@googlegroups.com>
1) Please read the rules for posting in this group.  Specifically:

"Please start subject lines with a Play version number or a module name-version, e.g. [2.0], [2.0-java], [2.0-scala], [1.2.4] or [gae-1.4]."

2) Please read the Play documentation that many folks have worked hard to create:

http://www.playframework.org/documentation/2.0.3/ScalaRouting

On Sep 30, 2012, at 7:55 PM, gokool <gokoo...@gmail.com>
 wrote:

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/oy6rH7_-hFcJ.
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.

Paulo "JCranky" Siqueira

unread,
Sep 30, 2012, 9:56:21 PM9/30/12
to play-fr...@googlegroups.com

You are specifying query params in the routes file, which I think its not necessary.

[]s,

Paulo "JCranky" Siqueira
http://jcranky.com
http://lojinha.paulosiqueira.com.br

neoPlayer

unread,
Oct 1, 2012, 1:48:55 AM10/1/12
to play-fr...@googlegroups.com
Sorry Sean, updated the subject line per the instructions.

Thanks for pointing it out JCranky. Basically my understanding of the routes configuration was wrong. It works with a straightforward "/search" alone now.
Reply all
Reply to author
Forward
0 new messages