how to get param in method post spring mvc?

后端 未结 4 1897
执笔经年
执笔经年 2020-11-29 23:59

I\'m using spring mvc. And I can\'t get param from url when method = post. But when I change method to GET, so I can get all param.

This is my form:

         


        
4条回答
  •  天涯浪人
    2020-11-30 00:35

    When I want to get all the POST params I am using the code below,

    @RequestMapping(value = "/", method = RequestMethod.POST)
    public ViewForResponseClass update(@RequestBody AClass anObject) {
        // Source..
    }
    

    I am using the @RequestBody annotation for post/put/delete http requests instead of the @RequestParam which reads the GET parameters.

提交回复
热议问题