Spring: @ModelAttribute VS @RequestBody -
Please correct me if I am wrong Data binding both can be used . The question is when the @Model Attribute is used? @RequestMapping (value = "/ owner / {OwnerId} / pet / {petId} / edit", method = RequestMethod.POST) Public String Process Submit (@ModelAttribute Pet pet) { } Additionally, when using @RequestBody? According to my understanding both do the same purpose. Thanks! Simple The way to my understanding, the
@RequestMapping (value = "/ user / saved contact", method = RequestMethod.POST public string save communication (@RequestBody contact contact) {}
@ Model Attribute will take a query string, so all the data is being passed through the URL via the URL.
@ RequestBody < / Code>, all data complete JSON Will be passed to the server through Odi.
Comments
Post a Comment