POST to controller: Having a controller read named elements in a post.
I know a rest controller can have the @RequestBody of a form get processed via Castor to a POJO in a controller. I do that today.
For Example:
Code:
@RequestMapping(value="/create", method=RequestMethod.POST)
public ResponseEntity<?> createItem(@RequestBody Item item){
However I could not find a way to do that if the post has key-value pairs, like in the following HTML.
Is there an annotation in a controller I can use to have the "textPayload" read and processed as a POJO?
HTML Code:
<form action="http://localhost:8080/materials-restservice/ccc/content/create" method="POST">
<textarea name="textPayload">
<?xml version="1.0" encoding="UTF-8"?>
<studynet>
<item>
<name>Person</name>
<price>10.23</price>
</item>
</studynet>
</textarea>
<input type="submit"/>
</form>