我想获取url-param id,但是它不起作用。是每个可以帮助我的人吗?
以下代码不起作用。
网址:
http://localhost:9000/rest/alerts?ids[]=123?ids[]=456
Routes.conf
GET /restws/alerts{ids} controllers.AlertService.findAlertsForIds(ids: List[String])
AlertService.java
public static Result findAlertsForIds(List<String> ids){
return ok("Coole Sache");
}
最佳答案
尝试像这样将id作为字符串传递http://<hostname>:9000/rest/alerts?ids=123,456,789
然后通过在字符串上应用split()函数来获取数组。
希望能帮助到你。
关于playframework - 获取一个URL参数数组,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17164337/