Spring: @ModelAttribute VS @RequestBody

后端 未结 7 486
闹比i
闹比i 2020-12-04 16:19

Please correct me if I am wrong. Both can be used for Data Binding.

The question is when to use @ModelAttribute?

@RequestMapping(val         


        
7条回答
  •  春和景丽
    2020-12-04 17:07

    The simplest way for my understanding is, the @ModelAttribute will take a query string. so, all the data are being pass to the server through the url.

    As for @RequestBody, all the data will be pass to the server through a full JSON body.

提交回复
热议问题