Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring分页-请求参数_Spring_Rest_Spring Mvc - Fatal编程技术网

Spring分页-请求参数

Spring分页-请求参数,spring,rest,spring-mvc,Spring,Rest,Spring Mvc,我的休息控制器: @GetMapping("/test") public Page<MyObject> pathParamTest(Pageable pageable) { return myService.getPage(pageable); } 这是我从服务器得到的响应: { "content": [ { "id": 1 }, { "i

我的休息控制器:

    @GetMapping("/test")
    public Page<MyObject> pathParamTest(Pageable pageable) {
        return myService.getPage(pageable);
    }
这是我从服务器得到的响应:

{
    "content": [
        {
            "id": 1
        },
        {
            "id": 2
        },
        {
            "id": 3
        }
    ],
    "last": true,
    "totalPages": 1,
    "totalElements": 3,
    "first": true,
    "sort": [
        {
            "direction": "ASC",
            "property": "id",
            "ignoreCase": false,
            "nullHandling": "NATIVE",
            "descending": false,
            "ascending": true
        }
    ],
    "numberOfElements": 3,
    "size": 3,
    "number": 0
}
但是请求仍然具有direction=ASC

如何发送到服务器direction=DESC

为什么响应有一个字段“last”=true,因为下一页还有一个元素?

试试看 localhost:8091/endpoint/test?page=0&size=3&sort=id,DESC

旋度-v “”

对格式中应按排序的属性进行排序 属性,属性(,ASC | DESC)。默认排序方向为升序。使用 如果要切换方向,请使用多个排序参数,例如。 排序=姓氏&排序=姓氏,asc


不,我没有发现我的问题。当我写短语:“SpringPagination”,“SpringPageable”时,我使用ModelView获得了14年的文章。哦,好的。我忘了每个人都是专家。原谅你不得不写这篇文章。。。可怜……如果有人知道答案的话,我还有一个与此密切相关的问题,但我认为这是不可能的。如何在查询中传递ignoreCase参数?我希望它会像:-curl-v“”一样简单,但它不是:-(
{
    "content": [
        {
            "id": 1
        },
        {
            "id": 2
        },
        {
            "id": 3
        }
    ],
    "last": true,
    "totalPages": 1,
    "totalElements": 3,
    "first": true,
    "sort": [
        {
            "direction": "ASC",
            "property": "id",
            "ignoreCase": false,
            "nullHandling": "NATIVE",
            "descending": false,
            "ascending": true
        }
    ],
    "numberOfElements": 3,
    "size": 3,
    "number": 0
}