'[2.0] is there an easy way to get a posted value

626 views
Skip to first unread message

sas

unread,
May 16, 2012, 7:32:46 AM5/16/12
to play-framework
In this article:

http://playlatam.wordpress.com/2012/04/10/play-framework-2-0-quicktip-como-obtener-un-valor-post-desde-un-controller/

It says that to get a posted value (in this case a "filter" paramter")
you have to issue something like this:

String filter = request().body().asFormUrlEncoded().get(“filter”)[0];

I wonder it there could be an easier way to do such a trivial thing,
something like:

String filter = request().form.get("filter")

(similtar to request().queryString) or something like that

saludos

sas


Julien Tournay

unread,
May 16, 2012, 7:48:04 AM5/16/12
to play-fr...@googlegroups.com
Hi,

form().get("filter")

jto.

sas

unread,
May 20, 2012, 10:55:46 PM5/20/12
to play-framework
Thanks, julien, but I couldn't make it work

I guess you're talking about java... with form() I get the following
error:

[IllegalStateException: No value]

I had to issue:

String name = form().bindFromRequest().get("java_name");

And I found other alternatives for java and scala

check this article

http://playlatam.wordpress.com/2012/05/21/play-framework-posted-values-revisited/

if you know of any other wayt to achieve it don't hesitate to comment
on it

saludos

sas

On 16 mayo, 08:48, Julien Tournay <boudhe...@gmail.com> wrote:
> Hi,
>
> form().get("filter")
>
> jto.
>
> Le mercredi 16 mai 2012 04:32:46 UTC-7, sas a écrit :
>
>
>
>
>
>
>
>
>
> > In this article:
>
> >http://playlatam.wordpress.com/2012/04/10/play-framework-2-0-quicktip...
Reply all
Reply to author
Forward
0 new messages