RequestParam 多参数
时间: 2023-08-23 22:17:24 浏览: 90
@RequestParam可以用于接收多个参数。在每个传入的参数前面加上@RequestParam注解即可。这个注解可以用于普通元素、数组、集合、对象等等。如果参数是放在请求体中传入后台,那么后台要用@RequestBody才能接收到。如果参数不是放在请求体中,那么后台可以用@RequestParam来接收。此外,@RequestParam还可以设置默认值,以保证如果传参为空不会报错。参数value可以让前后端的传参名保持一致。\[1\]\[2\]\[3\]
#### 引用[.reference_title]
- *1* *3* [springboot微服务前端传参数至后端的几个方式,@RequestBody如何传入多个参数@RequestParam](https://blog.csdn.net/weixin_43930851/article/details/126272215)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [@RequestBody总结相关](https://blog.csdn.net/qq_35946055/article/details/105047874)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文