当前位置:网站首页>@RequestBody使用
@RequestBody使用
2022-08-02 07:29:00 【sebeefe】
使用场景
@RequestBody主要用来接收前端传递给后端的json字符串中的数据的(即请求体中的数据的);
使用与否
(1)使用@RequestBody的情况:
- 参数是放在请求体中
- 当请求content_type为:application/json类型的请求,数据类型为json时, json格式如下:
{“aaa”:“111”,“bbb”:“222”}
(2)不使用@RequestBody的情况:
- 接收URL中的数据并组装为对象
- 当请求content_type为:application/x-www-form-urlencoded类型的或multipart/form-data时,数据格式为
aaa=111&bbb=222
注意:
1、一个请求最多只能有一个@RequestBody注解
2、Content-type:
(1)application/x-www-form-urlencoded:@RequestBody不是必须加的
(2)mutipart/form-data:@RequestBody不能处理这种格式
(3)其他格式,比如application/json,application/xml等,必须使用@RequestBody来处理
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
猜你喜欢
随机推荐
pnpm + workspace + changesets 构建你的 monorepo 工程
The best interests of buying and selling stocks with handling fees [What is missing in the definition of DP status?]
Understand Chisel language. 31. Chisel advanced communication state machine (3) - Ready-Valid interface: definition, timing and implementation in Chisel
Kind of weird!Access the destination URL, the host can container but not
MySQL-FlinkCDC-Hudi enters the lake in real time
替换ptmalloc,使用tcmalloc和jemalloc
2022-2023 十大应用开发趋势
I.MX6U-ALPHA开发板(定时器按键消抖)
【Network】IP, subnet mask
HCIP 第十三天
Introduction to mysql operation (4) ----- data sorting (ascending, descending, multi-field sorting)
ROS文件系统以及相关命令
RIP综合实验
研发创新编码器霍尔板,引领企业高质量发展
【CV】OpenVINO installation tutorial
postgres groupby merge strings
LeetCode刷题(7)
HCIP 第四天
Conditional constructor ~wapper
静态路由综合实验









