如何使用@RequestParam使用Spring MVC中捕获多个参数? [英] how to capture multiple parameters using @RequestParam using spring mvc?

查看:282
本文介绍了如何使用@RequestParam使用Spring MVC中捕获多个参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设一个超链接被点击和URL与下面的参数表解雇 myparam = myValue1&安培; myparam = myValue2&安培; myparam = myValue3 。现在,我怎么能捕捉Spring MVC中使用 @RequestRaram 的所有参数?

Suppose a hyperlink is clicked and an url is fired with the following parameter list myparam=myValue1&myparam=myValue2&myparam=myValue3 . Now how can I capture all the parameters using @RequestRaram in spring mvc?

我的要求是我必须捕获所有的PARAMS并把它们放在地图。

My requirement is I have to capture all the params and put them in a map.

请帮帮忙!

推荐答案

看来你不能

Map<String,String>

由于所有的PARAMS具有相同的名称myparam

because all your params have same name "myparam"

试试这个:

public ModelAndView method(@RequestParam("myparam") List<String> params) { }

这篇关于如何使用@RequestParam使用Spring MVC中捕获多个参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆