@RequestParam和@RequestBody的区别-------springMVC

https://blog.csdn.net/qq_27093465/article/details/50519444

@RequestParam

1,用来处理Content-Type: 为 application/x-www-form-urlencoded编码的内容。(默认类型

2,post和get请求都行

@RequestBody

1,request header Content-Type的值来判断: ,application/json, application/xml等。这些格式的数据,必须使用@RequestBody来处理

2, multipart/form-data, 不能处理(次类型多用来上传文件类型---即使用@RequestBody不能处理这种格式的数据,@RequestParam这个却是可以处理的。)

3,只能post请求

4,可以穿插着@RequestParam使用url上面的参数

posted on 2018-05-03 00:29  Kooing  阅读(412)  评论(0)    收藏  举报

导航