1
标签 说明 示范
@pathVariable("pageSize") 需要配合rest风格url使用,目的是接收rest Url中的参数 http://127.0.0.1:8082/hello/4
@RequestParam((value = "pageSize", required = false, defaultValue = "10")) 接收普通?后面携带的参数 http://127.0.0.1:8082/hello?pageSize=4
    @RequestMapping(value = "/hello/{pageSize}", method = RequestMethod.GET)
    public String say(@PathVariable("pageSize") String pageSize) {
        return pageSize;
    }

    @RequestMapping(value = "/hello", method = RequestMethod.GET)
    public String say2(@RequestParam(value = "pageSize", required = false, defaultValue = "10") String pageSize) {
        return pageSize;
    }

郭江江
9 声望1 粉丝

搬过砖的程序员