Map<String, String> as @RequestParam in Spring MVC -


i'm new spring , i'm trying add @requestparam of type map<string, string> controller 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 url looks this:

localhost/search?searchterm=factory&filters[name]=factory1&filters[name]=factory2 

but every time, filters null, no matter do.

can done? thank time!

using map @requestparam multiple params if method parameter map or multivaluemap map populated query string names , values. following mapped /employees/234/messages?sendby=mgr&date=20160210

@requestmapping("{id}/messages") public string handleemployeemessagesrequest (@pathvariable("id") string employeeid,                                         @requestparam map<string, string> querymap,                                         model model) {     model.addattribute("msg", "employee request id , query map : "+               employeeid+", "+querymap.tostring());     return "my-page"; } 

where employeeid = "234" , querymap = {sendby=mgr, date=20160210}


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -