# SpringBoot接口
# Controller获取参数方式
@PathVariable 获取URL中的参数
@RequestMapping(value = "test1/{name}", method = RequestMethod.POST)
public String test1(@PathVariable String name, Integer age) {
return "name:" + name + ",age:" + age;
}
1
2
3
4
2
3
4
HttpServletRequest
@RequestMapping(value = "/a", method = RequestMethod.POST)
public String a(HttpServletRequest request, HttpServletResponse response) {
return "name:" + request.getParameter("name") + ",age:" + request.getParameter("age");
}
1
2
3
4
2
3
4