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 @RequestParam
in spring mvc?
My requirement is I have to capture all the params and put them in a map.
Please help!
@RequestMapping(value = "users/newuser", method = RequestMethod.POST) public String saveUser(@RequestParam Map<String,String> requestParams) throws Exception{ String userName=requestParams.get("email"); String password=requestParams.get("password"); //perform DB operations return "profile"; }
You could use RequestParam in the above mentioned manner.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With