@RequestParam与@PathVariable的区别

xiaoxiao2021-02-28  81

在SpringMVC中,两者的作用都是接收参数

区别在于

@RequestParam时,URL是这样的:http://http://localhost:8097/web/login/user @RequestMapping(“/web/login/user”) public AuthUser login(@RequestParam(“username”) String username){}

@PathVariable时,URL是这样的:http://http://localhost:8097/active/appil/17 @RequestMapping(“active/appil/{id}”) public String newDetail(@PathVariable(“id”) Long id){}

转载请注明原文地址: https://www.6miu.com/read-43728.html

最新回复(0)