获取一个URL参数数组 [英] Get array of one url param

查看:161
本文介绍了获取一个URL参数数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取url-param id,但是它不起作用.是每个可以帮助我的人吗? 以下代码不起作用.

I want get the url-param ids, but It will not work. Is here everyone who can help me? The following code doesn't work.

网址:

http://localhost:9000/rest/alerts?ids[]=123?ids[]=456

Routes.conf

Routes.conf

GET /restws/alerts{ids} controllers.AlertService.findAlertsForIds(ids: List[String])

AlertService.java

AlertService.java

public static Result findAlertsForIds(List<String> ids){

 return ok("Coole Sache"); 

 }

推荐答案

尝试将ID作为字符串传递 http://<hostname>:9000/rest/alerts?ids=123,456,789

Try passing ids as string like this http://<hostname>:9000/rest/alerts?ids=123,456,789

,然后通过在字符串上应用split()函数来获取数组.

and then get the array by applying the split() function on the string.

希望有帮助.

这篇关于获取一个URL参数数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆