0

How to get below request params as a map (or any suitable java collection) in spring controller? I want request param 'filter' to be mapped into controller method.

http://example.com/users?filter[0][name]=Dane&filter[1][email]=dane@exm.com

EDIT:

I want something like this in my Rest Controller:

    public void getQueryParams(@RequestParam("filter") Map<String, String> filterValues) {
        //Method body....
    }

Is there a way to achieve this? Appreciate your help. Thanks.

J4Priyan
  • 224
  • 1
  • 2
  • 14
  • 1
    Possible duplicate of [Spring MVC - How to get all request params in a map in Spring controller?](http://stackoverflow.com/questions/7312436/spring-mvc-how-to-get-all-request-params-in-a-map-in-spring-controller) – Blank Feb 16 '17 at 01:15
  • Map params = request.getParameterMap(); – Harshil Feb 16 '17 at 04:44

1 Answers1

0

Use a List instead of a Map. The List will contain all values of the parameter 'filter'

public void getQueryParams(@RequestParam("filter") List<String> filterValues) {
    //Method body....
}