【发布时间】:2017-12-10 15:52:33
【问题描述】:
我正在尝试将四个项目的数组添加到驱动程序类的调用中。我的 JavaScript 代码是这样工作的:
request.open("GET","rest/ds/acceptInput?UserInput="+document.getElementById('text').value, async=true);
request.send()
我使用它来将用户输入发送给驱动程序,并且这工作带有带注释的驱动程序(见下文)。
@Test
@Path("acceptInput")
@GET
@Consumes("text/plain")
@Produces(MediaType.APPLICATION_JSON)
public String acceptInput(@QueryParam("UserInput") String input{
现在我希望能够在调用驱动程序的同时发送一个数组(通过 JavaScript 中的用户复选框获得)。我尝试了几种方法,但对我来说有意义的是:
JavaScript 代码如下:
request.open("GET","rest/ds/acceptInput?UserInput="+document.getElementById('text').value + checked[0],checked[1],checked[2],checked[3], async=true);
request.send()
而司机接受它是这样的:
@Test
@Path("acceptInput")
@GET
@Consumes("text/plain")
@Produces(MediaType.APPLICATION_JSON)
public String acceptInput(@QueryParam("UserInput") String input, @QueryParam("po") boolean Po, @QueryParam("cl") boolean Cl, @QueryParam("ac") boolean Ac, @QueryParam("qu") boolean Qu) {
但现在我最终没有返回任何结果。任何想法为什么会发生这种情况?
【问题讨论】:
标签: javascript java rest