I'm new to spring and I'm trying to add a @RequestParam
of type Map<String, String>
to my controller like this:
@RequestMapping(method = RequestMethod.GET)
public Model search(@RequestParam(value = "searchTerm", required = false) final String searchTerm,
@RequestParam(value = "filters", required = false) Map<String, String> filters,
final Model model) {
And in the URL it looks like this:
localhost/search?searchTerm=factory&filters[name]=factory1&filters[name]=factory2
But every time, filters is null
, no matter what I do.
Can this be done? Thank you very much for your time!