how to capture multiple parameters using @RequestParam using spring mvc?

前端 未结 6 1448
独厮守ぢ
独厮守ぢ 2020-11-30 01:34

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

6条回答
  •  甜味超标
    2020-11-30 02:34

    @RequestMapping(value = "users/newuser", method = RequestMethod.POST)   
    public String saveUser(@RequestParam Map 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.

提交回复
热议问题