当前位置:网站首页>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笔记
边栏推荐
- [proteus simulation] 51 MCU +lcd12864 push box game
- 密码技术---分组密码的模式
- Connexion à distance de la tarte aux framboises en mode visionneur VNC
- php 获取真实ip
- RuntimeError: no valid convolution algorithms available in CuDNN
- PHP get real IP
- 采用VNC Viewer方式远程连接树莓派
- 20220527_数据库过程_语句留档
- Is 408 not fragrant? The number of universities taking the 408 examination this year has basically not increased!
- 可知论与熟能生巧
猜你喜欢
Go basic data type
C# MVC创建一个视图摆脱布局的影响
[favorite poems] OK, song
Go basic anonymous variable
Alibaba cloud award winning experience: how to use polardb-x
Third party payment function test point [Hangzhou multi tester _ Wang Sir] [Hangzhou multi tester]
Start from the bottom structure to learn the customization and testing of FPGA --- Xilinx ROM IP
(毒刺)利用Pystinger Socks4上线不出网主机
設置單擊右鍵可以選擇用VS Code打開文件
【Redis笔记】压缩列表(ziplist)
随机推荐
Solving ordinary differential equations with MATLAB
[live broadcast appointment] database obcp certification comprehensive upgrade open class
[analysis of STL source code] imitation function (to be supplemented)
Set right click to select vs code to open the file
Pandora IOT development board learning (HAL Library) - Experiment 4 serial port communication experiment (learning notes)
[npuctf2020]ezlogin XPath injection
提交代码流程
Win11如何开启目视控制?Win11开启目视控制的方法
解决:exceptiole ‘xxxxx.QRTZ_LOCKS‘ doesn‘t exist以及mysql的my.cnf文件追加lower_case_table_names后启动报错
設置單擊右鍵可以選擇用VS Code打開文件
Alibaba cloud award winning experience: how to use polardb-x
Ideal car × Oceanbase: when the new forces of car building meet the new forces of database
简述中台的常识
RuntimeError: no valid convolution algorithms available in CuDNN
Warning: implicitly declaring library function 'printf' with type 'int (const char *,...)‘
用matlab调用vs2015来编译vs工程
The use of 8255 interface chip and ADC0809
Go basic data type
How difficult is it to be high? AI rolls into the mathematics circle, and the accuracy rate of advanced mathematics examination is 81%!
Editor Caton