I am reading the documentation about the controller http://www.playframework.org/documentation/1.1/controllers and I know how to define them on the controller side.
public static void show(Long[] id) {
...
}
or:
public static void show(List<Long> id) {
...
}
or:
public static void show(Set<Long> id) {
...
}
Now, how do I call the controller and pass the array ? I tried
Application/show?id=1,2,3,4
it doesn't work
The simplest way is
Application/show?id=1&id=2&id=3&id=4
There is also a solution using @As annotation for custom binding since 1.1:
http://www.playframework.org/documentation/1.1/releasenotes-1.1#play.data.binding.As
You pass them as normal HTTP parameters
Application/show?id[0]=1&id[1]=2&id[2]=3&id[3]=4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With