So this is a super novice question. Im running this tutorial and in some of the methods like this:
@RequestMapping(value="/string", method=RequestMethod.POST)
public @ResponseBody String readString(@RequestBody String string) {
return "Read string '" + string + "'";
}
where there is a string as a requestbody, the string is foo but i don't know how it is set. Is there some method somewhere that sets a default or what (maybe i'm missing something super obvious). The html looks like this
<form id="readString" class="textForm" act开发者_开发百科ion="<c:url value="/messageconverters/string" />" method="post">
<input id="readStringSubmit" type="submit" value="Read a String" />
</form>
Thanks for any help you can provide.
As far as I understand the "@RequestBody String string" variable is being set by Spring when you submit your html form using the using post request method.
精彩评论