大家好,又见面了,我是你们的朋友全栈君。
http://localhost:8080/springmvc/rest/passValue/param?name=root
/** * @RequestParam是默认接收参数的方式,可以省略 * @RequestParam还可以接收form表单提交的数据 */
@GetMapping("/param")
public String getByParam(@RequestParam String name)
@DeleteMapping("/param")
public String deleteByParam(@RequestParam String name)
http://localhost:8080/springmvc/rest/passValue/root
@GetMapping("/path/{name}")
public String getByPath(@PathVariable String name)
@DeleteMapping("/path/{name}")
public String deleteByPath(@PathVariable String name)
http://localhost:8080/springmvc/rest/passValue/body
@PostMapping("/body")
public String postByBody(@RequestBody User user)
@PutMapping("/body")
public String putByBody(@RequestBody User user)
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/141376.html原文链接:https://javaforall.cn