content-type

来源:互联网 发布:淘宝互相收藏 编辑:程序博客网 时间:2024/06/05 22:53

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

requestbody为:

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


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

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



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

requestbody为:

realName=songml&idcard=11111111111&sex=1

参数接受时候不能用@requestBody

我们是可以接受到参数的

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




总结

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


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

原创粉丝点击