第一类:请求路径参数
1、@PathVariable

获取路径参数。即url/{id}这种形式。
2、@RequestParam

获取查询参数。即url?name=这种形式
例子

GET
http://localhost:8080/demo/123?name=suki_rong
对应的java代码:

@GetMapping("/demo/{id}")
public void demo(@PathVariable(name = "id") String id, @RequestParam(name = "name") String name) {
    System.out.println(".equals(cookie.getName())) {
            System.out.println(cookie.getValue());
        }
    }
}
---------------------
作者:suki_rong
来源:CSDN
原文:https://blog.csdn.net/suki_rong/article/details/80445880
版权声明:本文为博主原创文章,转载请附上博文链接!

相关文章:

  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2021-05-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-23
相关资源
相似解决方案