How to get Form data as a Map in Spring MVC controller?

You can also use @RequestBody with MultiValueMap
e.g.

@RequestMapping(value="/create",
                method=RequestMethod.POST,
                consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public String createRole(@RequestBody MultiValueMap<String, String> formData){
 // your code goes here
}

Now you can get parameter names and their values.

MultiValueMap is in Spring utils package

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)