content-type

Content-Type:application/json; charset=UTF-8

requestbody为:

{"realName":"songml","idcard":"111111111"}


content-type

这个时候 后来接受参数要用@RequestBody来接受,

content-type

我们看到参数接受到了,但是req.getparamter是获取不到的。

content-type



Content-Type:application/x-www-form-urlencoded;charset=UTF-8

requestbody为:

realName=songml&idcard=11111111111&sex=1

参数接受时候不能用@requestBody

content-type

我们是可以接受到参数的

content-type

并且req.getparamter也是可以获取到值的

content-type



总结

Content-Type:application/json; charset=UTF-8 这种getparrmter是获取不到值的,要想获取到值,得用@requestBody bean 来接受参数


Content-Type:application/json; charset=UTF-8这种getparrmter是可以获取值的,可以直接用bean接受参数。