Play 2.0 Java: Bind an array from request

前端 未结 2 426
情话喂你
情话喂你 2021-01-05 15:54

I... stuck o.O

I\'ve params in foreign request:

param[62537]=abc;
param[20356]=cde;
param[92837]=fgh;

And I\'m looking for

相关标签:
2条回答
  • 2021-01-05 16:31

    The reason why this does not work is that there is no QueryStringBinder for List[String] or Array[String] available yet in the framework. As far as I know, this is planned for Play 2.1.

    If you need it now, you can try the solution shown here: QueryStringBinder for List[String]

    0 讨论(0)
  • 2021-01-05 16:40

    Not the prettiest way, but did you try to get the keys of the Map returned by asFormUrlEncoded:

    Set<String> keys = request().body().asFormUrlEncoded().keySet();
    for (String key : keys) {
         // check if key begin with "param["
    }
    
    0 讨论(0)
提交回复
热议问题