一、HttpServletRequest req——获取参数值value
1、Postman 在params逐个参数赋值
@PostMapping("/xxx")
String id=req.getParameter(“id”);
后端通过如上的方法一个个去获取;
二、@RequestBody 返回体VO xxx ——获取JSON参数
1、Postman 在Body通过JSON传参
传参格式:
{
"id":"id",
"name":"name"
}
2、POST需要添加produces = “application/json;charset=UTF-8”, consumes = “application/json;charset=UTF-8”
@PostMapping(value="/xxx" ,produces = "application/json;charset=UTF-8", consumes = "application/json;charset=UTF-8")