在 GET 请求中发送两个参数

Send two params in GET request

我是 vertx 框架的新手,在文档中我看不到关于如何在 GET 请求中发送两个参数的愚蠢的事情。到目前为止我试过了。

    $.getJSON('/user/'+ attributeName + ":"+value, function (data) {
    userListData = data;
    $.each(data, function () {
        $('#userInfoName').text(data.fullname);
        $('#userInfoAge').text(data.age);
        $('#userInfoGender').text(data.gender);
        $('#userInfoLocation').text(data.location);
    });
});

然后在服务器端

     router.get("/user/:attributeName:value").handler(routingContext -> {
        JsonObject query = new JsonObject();
        query.put(routingContext.request().getParam("attributeName"), routingContext.request().getParam("value")); 

但后来我可以看到 attributeName 如何不仅获得第一个参数的值而且获得第二个参数的一部分,非常奇怪。

你可能做错了。您可以将它作为单个参数获取,然后用“:”拆分,或者在 url 中将两个参数定义为... /:attribname/:value/... 两者都会满足您的要求