当前位置:网站首页>JSON数据传递参数
JSON数据传递参数
2022-07-02 22:16:00 【pengege666】
文章目录
使用JSON数据传递入门
step1:pom.xml中导入坐标
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.0</version>
</dependency>
step2:核心配置文件添加@EnableWebMvc注解
SpringMVCConfig.java
@Configuration
@ComponentScan("com.itheima.controller")
@EnableWebMvc
public class SpringMVCConfig {
}
step3:构造json格式数据
step4:参数前添加@RequestBody注解
UserController.java
@Controller
@RequestMapping("/User")
public class UserController {
//2.2设置当前操作的访问路径
@RequestMapping("/save")
@ResponseBody
public String save(@RequestBody List<String> list){
System.out.println(list);
System.out.println("user save ...");
return "{'module':'springmvc'}";
}
}
参数类型
集合类型
POJO参数
集合参数
参考:
感谢SpringMVC笔记
边栏推荐
- golang入门:for...range修改切片中元素的值的另类方法
- Static file display problem
- SharedPreferences save list < bean > to local and solve com google. gson. internal. Linkedtreemap cannot be cast to exception
- Introduction to the latest plan of horizon in April 2022
- Ideal car × Oceanbase: when the new forces of car building meet the new forces of database
- Getting started with golang: for Range an alternative method of modifying the values of elements in slices
- Numerical solution of partial differential equations with MATLAB
- 非路由组件之头部组件和底部组件书写
- 富滇银行完成数字化升级|OceanBase数据库助力布局分布式架构中台
- Explain promise usage in detail
猜你喜欢
CDN acceleration requires the domain name to be filed first
Looking at Ctrip's toughness and vision from the Q1 financial report in 2022
[redis notes] compressed list (ziplist)
Hisilicon VI access video process
QT qpprogressbar details
[Yangcheng cup 2020] easyphp
The first batch of Tencent cloud completed the first cloud native security maturity assessment in China
潘多拉 IOT 开发板学习(HAL 库)—— 实验4 串口通讯实验(学习笔记)
聊聊内存模型与内存序
数字图像处理实验目录
随机推荐
RuntimeError: no valid convolution algorithms available in CuDNN
Looking at Ctrip's toughness and vision from the Q1 financial report in 2022
Where is the win11 microphone test? Win11 method of testing microphone
【直播预约】数据库OBCP认证全面升级公开课
Solution to boost library link error
Alibaba cloud award winning experience: how to use polardb-x
What experience is there only one test in the company? Listen to what they say
Sword finger offer II 099 Sum of minimum paths - double hundred code
20220527_ Database process_ Statement retention
[adjustment] postgraduate enrollment of Northeast Petroleum University in 2022 (including adjustment)
CDN 加速,需要域名先备案
可知论与熟能生巧
RuntimeError: no valid convolution algorithms available in CuDNN
Application of containerization technology in embedded field
(毒刺)利用Pystinger Socks4上线不出网主机
Catalogue of digital image processing experiments
Why does RTOS system use MPU?
20220524_数据库过程_语句留档
What can I do after buying a domain name?
golang中new与make的区别