当前位置:网站首页>请求与响应
请求与响应
2022-07-02 22:16:00 【pengege666】
请求映射路径
团队多人开发,每人设置不同的请求路径,冲突问题如何解决—设置模块名作为请求路径前缀

使用postman软件发送请求
请求参数
普通参数
发送携带参数的Get请求

实验操作
@Controller
@RequestMapping("/User")
public class UserController {
//2.2设置当前操作的访问路径
@RequestMapping("/save")
@ResponseBody
public String save(String name){
System.out.println(name);
System.out.println("user save ...");
return "{'module':'springmvc'}";
}
}


当请求参数名与形参变量名不同时,使用RequestParam进行解决。
发送携带参数的Post请求
注意Post请求的发送方式

POJO参数


public class User {
String name;
int id;
//省略Getter,Setter和ToString方法
}
UserController.java
@Controller
@RequestMapping("/User")
public class UserController {
//2.2设置当前操作的访问路径
@RequestMapping("/save")
@ResponseBody
public String save(User user){
System.out.println(user);
System.out.println("user save ...");
return "{'module':'springmvc'}";
}
}


POJO嵌套的POJO参数



数组参数

集合参数

边栏推荐
- 基于Pyqt5工具栏按钮可实现界面切换-2
- Fusion de la conversion et de la normalisation des lots
- Win11自动关机设置在哪?Win11设置自动关机的两种方法
- 【STL源码剖析】仿函数(待补充)
- (stinger) use pystinger Socks4 to go online and not go out of the network host
- Where is the win11 microphone test? Win11 method of testing microphone
- Brief introduction to common sense of Zhongtai
- Compose 中的 'ViewPager' 详解 | 开发者说·DTalk
- Jinglianwen technology's low price strategy helps AI enterprises reduce model training costs
- 潘多拉 IOT 开发板学习(HAL 库)—— 实验4 串口通讯实验(学习笔记)
猜你喜欢

Prometheus deployment

I've been interviewed. The starting salary is 16K

Getting started with golang: for Range an alternative method of modifying the values of elements in slices

理想汽车×OceanBase:当造车新势力遇上数据库新势力

Where is the win11 automatic shutdown setting? Two methods of setting automatic shutdown in win11

Fusion de la conversion et de la normalisation des lots

海思 VI接入视频流程

PotPlayer设置最小化的快捷键

What can I do after buying a domain name?

2022年最新最全软件测试面试题大全
随机推荐
Fusion de la conversion et de la normalisation des lots
Loss function~
All things work together, and I will review oceanbase's practice in government and enterprise industry
第三方支付功能测试点【杭州多测师_王sir】【杭州多测师】
门牌制作 C语言
Typical case of data annotation: how does jinglianwen technology help enterprises build data solutions
购买完域名之后能干什么事儿?
Solving ordinary differential equations with MATLAB
Connexion à distance de la tarte aux framboises en mode visionneur VNC
Redis 过期策略+conf 记录
Win11如何开启目视控制?Win11开启目视控制的方法
RuntimeError: no valid convolution algorithms available in CuDNN
Pandora IOT development board learning (HAL Library) - Experiment 4 serial port communication experiment (learning notes)
BBR encounters cubic
How difficult is it to be high? AI rolls into the mathematics circle, and the accuracy rate of advanced mathematics examination is 81%!
Strictly abide by the construction period and ensure the quality, this AI data annotation company has done it!
Li Kou brush questions (2022-6-28)
Implementation of VGA protocol based on FPGA
"A good programmer is worth five ordinary programmers!"
[adjustment] postgraduate enrollment of Northeast Petroleum University in 2022 (including adjustment)