当前位置:网站首页>@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开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- A full review of mainstream timed task solutions
- How to export multiple query results at once in SQL server 2014?
- playwright 爬虫使用
- Introduction to mysql operation (4) ----- data sorting (ascending, descending, multi-field sorting)
- postgres groupby merge strings
- JVM垃圾回收与性能调优方式
- Splunk Field Caculated Calculated Field
- Postgres horizontal table, automatically create partitions, table by time
- Data Middle Office: Started in Ali, Prosperous in DaaS
- 牛客2022 暑期多校4 D Jobs (Easy Version)(递推优化策略)
猜你喜欢

设置工作模式与环境(中):建造二级引导器

PanGu-Coder:函数级的代码生成模型

Understand Chisel language. 31. Chisel advanced communication state machine (3) - Ready-Valid interface: definition, timing and implementation in Chisel

Enterprise training and reproduction guidebook - training and reasoning of the OpenPose model based on Huawei ModelArts platform, realizing the recognition of two behaviors of climbing and climbing ov

Neural network

MySQL事务隔离级别详解

2022-2023 十大应用开发趋势

Introduction to Totem Pole and Push-Pull Circuits

MySQL之创建表的基本操作
![MySQL报错1055解决办法:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains](/img/aa/ab58ec47bb96df803dbc6a8ff6dde3.png)
MySQL报错1055解决办法:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains
随机推荐
MySQL事务(transaction) (有这篇就足够了..)
PLSQL Developer安装和配置
MySQL优化之慢日志查询
MySQL - low level settings
Enterprise training and reproduction guidebook - training and reasoning of the OpenPose model based on Huawei ModelArts platform, realizing the recognition of two behaviors of climbing and climbing ov
7.联合索引(最左前缀原则)
HCIP 第十二天
MySQL database design specification
How to export multiple query results at once in SQL server 2014?
gdalinfo: error while loading shared libraries: libgdal.so.30: cannot open shared object file: No su
常用的云安全防护措施盘点
MySQL-索引优化和查询优化
Please tell me, how to write Flink SQL and JDBC sink into mysql library and want to create an auto-incrementing primary key
WebForm DropDownList分别绑定年月
postgres groupby merge strings
替换ptmalloc,使用tcmalloc和jemalloc
HCIP第一天
理论问题与工程问题的差异在哪里?
五款优秀免费的在线抠图工具
Buried development process