DataForm posting values but on server its null

2019-09-08 17:38发布

using the DataForm object I found that its posting values correctly to server. Here is the screenshot enter image description here

but on server I am getting null for these object. Here is my server side code

    @RequestMapping(method = POST, value = "/create", produces = "application/json")
    @ResponseBody
    public UIResponse createDS(@Validated @ModelAttribute(value = "dS") DSDto dSDto,
            BindingResult result) {
 //here dSDto.name and dSDto.description is null
}

1条回答
The star\"
2楼-- · 2019-09-08 17:50

you have to add the @RequestBody annotation so Spring would convert the incoming JSON to a object from the post body .take a look at this stack overflow post @RequestBody and @ResponseBody annotations in Spring

查看更多
登录 后发表回答