@ModelAttribute
RequestMapping(value="/owners/{ownerId}/pets/{petId}/edit", method =
RequestMethod.POST)
public String processSubmit(@ModelAttribute Pet pet) { }
http://.../?name=Something&age=100
public String doSomething(@ModelAttribute User user) { }
@RequestBody
@RequestMapping(value = "/user/savecontact", method = RequestMethod.POST
public String saveContact(@RequestBody Contact contact){ }
{ "name": "Something", "age": "100" } in request body
public String doSomething(@RequestBodyUser user) { }
@ModelAttribute will take a query string. so, all the data are being pass to the server through the url
@RequestBody, all the data will be pass to the server through a full JSON body
- Now which one is the best approach ???
- If both are for same purpose to bind to the bean..which one is the best practice or widely used as standard practice?
Both handles multi-part file and does it both have equivalent options with one another ? https://javabeat.net/spring-multipart-file-upload/ How do i upload/stream large images using Spring 3.2 spring-mvc in a restful way
Does any one of them has lesser capabilities then the other one? Like length limitations, method limitations. Drawbacks
- Which one is more secured in terms of security ?