当前位置:网站首页>请求与响应
请求与响应
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参数
数组参数
集合参数
边栏推荐
- 为什么RTOS系统要使用MPU?
- 海思调用接口之Makefile配置
- 高数有多难?AI 卷到数学圈,高数考试正确率 81%!
- How does win11 turn on visual control? Win11 method of turning on visual control
- C MVC creates a view to get rid of the influence of layout
- Tiktok actual combat ~ number of likes pop-up box
- 基于Pyqt5工具栏按钮可实现界面切换-1
- 基于FPGA的VGA协议实现
- Quantitative analysis of PSNR, SSIM and RMSE
- Li Kou brush questions (2022-6-28)
猜你喜欢
Use redis to realize self increment serial number
The concepts of terminal voltage, phase voltage and line voltage in FOC vector control and BLDC control are still unclear
[live broadcast appointment] database obcp certification comprehensive upgrade open class
Hisilicon VI access video process
How does win11 turn on visual control? Win11 method of turning on visual control
内网渗透 | 手把手教你如何进行内网渗透
采用VNC Viewer方式遠程連接樹莓派
购买完域名之后能干什么事儿?
2022年最新最全软件测试面试题大全
RuntimeError: no valid convolution algorithms available in CuDNN
随机推荐
RecyclerView结合ViewBinding的使用
深度剖析数据在内存中的存储----C语言篇
Win11麦克风测试在哪里?Win11测试麦克风的方法
Cryptographic technology -- key and ssl/tls
Win11启用粘滞键关闭不了怎么办?粘滞键取消了但不管用怎么解决
Use of recyclerview with viewbinding
Loss function~
Cryptography -- the mode of block cipher
20220524_ Database process_ Statement retention
Prometheus deployment
Boost库链接错误解决方案
购买完域名之后能干什么事儿?
海思调用接口之Makefile配置
How does win11 turn on visual control? Win11 method of turning on visual control
高数有多难?AI 卷到数学圈,高数考试正确率 81%!
Ideal car × Oceanbase: when the new forces of car building meet the new forces of database
Call vs2015 with MATLAB to compile vs Project
C#中Linq用法汇集
Numerical solution of partial differential equations with MATLAB
Deep analysis of data storage in memory - C language