@PathVariable

时间:2023-03-10 05:09:56
@PathVariable

@PathVariable是用来对指定请求的URL路径里面的变量

eg: Java代码

@RequestMapping(value = "form/{id}/apply", method = {RequestMethod.PUT, RequestMethod.POST})

{id}在这个请求的URL里就是个变量,可以使用@PathVariable来获取

@PathVariable和@RequestParam的区别就在于:@RequestParam用来获得静态的URL请求入参