当前位置:网站首页>@Requestparam use
@Requestparam use
2022-07-28 17:31:00 【Uh huh, uh huh】
1、 The difference between adding and not adding
@RequestMapping("/list1")
public String test1(int userId) {
return "list";
}
@RequestMapping("/list2")
public String test2(@RequestParam int userId) {
return "list";
}
(1) No addition @RequestParam The parameter name of the front end must be consistent with the variable name of the back-end controller to take effect
(2) No addition @RequestParam Parameters are not required , Add @RequestParam The writing parameter is required . but @RequestParam Can pass @RequestParam(required = false) Set to not required .
(3)@RequestParam Can pass @RequestParam(“userId”) perhaps @RequestParam(value = “userId”) Specify the passed in parameter name .
(4)@RequestParam Can pass @RequestParam(defaultValue = “0”) Specify parameter defaults
(5) If the interface has a back-end besides the front-end call RPC call , Cannot be omitted @RequestParam, otherwise RPC The parameter will not be found and an error will be reported
(6) During the interview :
- No addition @RequestParam annotation :url With or without parameters , Input localhost:8080/list1 as well as localhost:8080/list1userId=xxx Methods can execute
- Add @RequestParam annotation :url Must have parameters . That is, you enter directly localhost:8080/list2 Will report a mistake , Method... Will not be executed . Input only localhost:8080/list2userId=xxx To execute the corresponding method
边栏推荐
- Use of influxdb2
- Goweb开发之Beego框架实战:第五节 项目搭建及注册用户
- 【ansible】ansible shell 执行远程命令遇到awk 中$符号的问题
- 关于标准IO缓冲区的问题
- 技术面轻松通过,HR:只有三年大厂经验的不值20K
- Shell脚本之AWK
- Application system log structure of elastic stack
- Asynchronous circuit design -- principle and example of synchronous pulser
- 高速电路中电阻的选择
- How to protect image security during construction
猜你喜欢

Selection of resistance in high speed circuit

Verilog daily question (vl6 data series to parallel circuit)

使用阿里云免费的SSL证书

Zero foundation uses unity3d to develop AR applications and download 3D models remotely

Goweb开发之Beego框架实战:第三节 程序执行流程分析

2021 年全国大学生数据统计与分析竞赛

Goweb开发之Beego框架实战:第四节 数据库配置及连接

MySQL详细学习教程(建议收藏)

Janus series article 3 API usage guide videoroom creating a new video room

Valarray Library Learning
随机推荐
软考回顾总结
Mysql database development specification
Shell编程之Sed
High speed circuit design practice -- Overview
MySQL的触发器
SNAT、DNAT 防火墙规则的备份和还原
【sqoop】sqoop1.4.7 安装集成CDH5.13
The practice of beego framework in goweb development: Section I Introduction to beego framework
Goweb开发之Iris框架实战:项目总结与回顾
In some cases, error: (XX, XX) failed to resolve: XXXXXX.
Pytorch Foundation: similarities and differences between torch.mul, torch.mm and torch.matmul
GEAR: Graph-based Evidence Aggregating and Reasoning for Fact Verification
Use of influxdb2
Goweb开发之Beego框架实战:第三节 程序执行流程分析
Verilog 每日一题(VL6 数据串转并电路)
With a total data volume of more than trillions of lines, Yuxi cigarette factory can easily deal with it by correctly selecting the timing database
QR code generation of wechat applet with parameters
Wechat applet cash red packet returns the error "the IP address is not the available IP address you set on the merchant platform". The ultimate solution
Editor MAVON editor for offline use
Verilog daily question (vl24 multi bit MUX synchronizer cross time domain output)