<textarea name="Comments" id="Comments" maxlength="10000"></textarea>
符合要求
<textarea name="Comments" id="Comments" maxlength="10000">
</textarea>
不符合
还有415:org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded' not supported
form提交默认为: application/x-www-form-urlencoded'编码
springMvc 默认为json。
只需要去掉@RequestBody
格式如下:
@RequestMapping(value = "/addcontact", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, method = RequestMethod.POST) public @ResponseBody RegisterObj addContact(RegisterObj registerObj) {