当前位置:网站首页>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笔记
边栏推荐
猜你喜欢

Talk about memory model and memory order

Markdown basic grammar

Introduction to the latest plan of horizon in April 2022

Redis 过期策略+conf 记录

基于Pyqt5工具栏按钮可实现界面切换-1
![Simple square wave generating circuit [51 single chip microcomputer and 8253a]](/img/fa/83a5a1ef2d8b95923e6084d6ef1fa2.jpg)
Simple square wave generating circuit [51 single chip microcomputer and 8253a]

Use of recyclerview with viewbinding

RecyclerView结合ViewBinding的使用

潘多拉 IOT 开发板学习(HAL 库)—— 实验4 串口通讯实验(学习笔记)

Connexion à distance de la tarte aux framboises en mode visionneur VNC
随机推荐
Static file display problem
20220527_ Database process_ Statement retention
Set right click to select vs code to open the file
第三方支付功能测试点【杭州多测师_王sir】【杭州多测师】
4 special cases! Schools in area a adopt the re examination score line in area B!
海思调用接口之Makefile配置
Ping domain name error unknown host, NSLOOKUP / system d-resolve can be resolved normally, how to Ping the public network address?
SQL advanced syntax
Catalogue of digital image processing experiments
实现BottomNavigationView和Navigation联动
Solution: exceptiole 'xxxxx QRTZ_ Locks' doesn't exist and MySQL's my CNF file append lower_ case_ table_ Error message after names startup
BBR 遭遇 CUBIC
Connexion à distance de la tarte aux framboises en mode visionneur VNC
Arduino - character judgment function
Submit code process
【STL源码剖析】仿函数(待补充)
“一个优秀程序员可抵五个普通程序员!”
Solving ordinary differential equations with MATLAB
阿里云有奖体验:如何使用 PolarDB-X
[adjustment] postgraduate enrollment of Northeast Petroleum University in 2022 (including adjustment)