当前位置:网站首页>How to pass array parameters in get request
How to pass array parameters in get request
2022-07-01 13:55:00 【Mingkuai de xuanmi 61】
Mode one
You can pass array parameters multiple times ,springmvc Multiple parameters with the same name will be automatically encapsulated into an array or collection object , Examples are as follows :
# request URL
http://127.0.0.1:8080/getUsers?name= Zhang San &name= Li Si
# Background interface code
@RestController
@RequestMapping("/")
public class SpringMvcController {
@RequestMapping(value = "/getUsers", method = RequestMethod.GET)
# String[] name You can also switch to List<String,String> name
public String getUsers(@RequestParam String[] name) {
return name[0] + " " + name[1];
}
}
Mode two
Directly separate array fingers with commas , Examples are as follows :
# request URL
http://127.0.0.1:8080/getTeachers?name= Wang Wu , Liu Mazi
# Background interface code
@RestController
@RequestMapping("/")
public class SpringMvcController {
@RequestMapping(value = "/getTeachers", method = RequestMethod.GET)
# String[] name You can also switch to List<String,String> name
public String getTeachers(@RequestParam String[] name) {
return name[0] + " " + name[1];
}
}
边栏推荐
- Interpretation of R & D effectiveness measurement framework
- Arthas use
- C语言订餐管理系统
- [machine learning] VAE variational self encoder learning notes
- Summary of 20 practical typescript single line codes
- Error:Kotlin: Module was compiled with an incompatible version of Kotlin. The binary version of its
- 使用 Lambda 函数URL + CloudFront 实现S3镜像回源
- 焱融看 | 混合云时代下,如何制定多云策略
- Blind box NFT digital collection platform system development (build source code)
- When you really learn databinding, you will find "this thing is really fragrant"!
猜你喜欢

04 redis source code data structure dictionary

How will the surging tide of digitalization overturn the future?

AnimeSR:可学习的降质算子与新的真实世界动漫VSR数据集
![[flask] flask starts and implements a minimal application based on flask](/img/45/77df241c85c4916914a37bb78275a5.png)
[flask] flask starts and implements a minimal application based on flask

面试题目总结(1) https中间人攻击,ConcurrentHashMap的原理 ,serialVersionUID常量,redis单线程,

孔松(信通院)-数字化时代云安全能力建设及趋势

详细讲解面试的 IO多路复用,select,poll,epoll

佩服,阿里女程序卧底 500 多个黑产群……

当你真的学会DataBinding后,你会发现“这玩意真香”!
![[IOT design. Part I] stm32+ smart cloud aiot+ laboratory security monitoring system](/img/a0/2654d43cfb6a135cc15d84447a13f9.png)
[IOT design. Part I] stm32+ smart cloud aiot+ laboratory security monitoring system
随机推荐
Sign APK with command line
04-Redis源码数据结构之字典
原来程序员搞私活这么赚钱?真的太香了
【IoT毕设.上】STM32+机智云AIoT+实验室安全监控系统
Summary of interview questions (1) HTTPS man in the middle attack, the principle of concurrenthashmap, serialVersionUID constant, redis single thread,
Anti fraud, refusing to gamble, safe payment | there are many online investment scams, so it's impossible to make money like this
QT社团管理系统
使用 Lambda 函数URL + CloudFront 实现S3镜像回源
Introduction to distributed transactions (Seata)
Understand the window query function of tdengine in one article
8款最佳实践,保护你的 IaC 安全!
Arthas use
IO的几种模型 阻塞,非阻塞,io多路复用,信号驱动和异步io
玩转MongoDB—搭建MongoDB集群
Solution to 0xc000007b error when running the game [easy to understand]
MySQL日志
洞态在某互联⽹⾦融科技企业的最佳落地实践
2022上半年英特尔有哪些“硬核创新”?看这张图就知道了!
Station B was scolded on the hot search..
被裁三个月,面试到处碰壁,心态已经开始崩了