首页 > 代码库 > spring mvc @RequestBody接受post json对象

spring mvc @RequestBody接受post json对象

jq ajax通过post json对象

遇到的HTTP 415/400问题错误解决方案:http://www.linuxidc.com/Linux/2014-04/99928.htm

客户端:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript"
	src=http://www.mamicode.com/"resources/scripts/jquery-2.0.3.min.js"></script>> 


spring mvc 服务端:

@RequestMapping(value=http://www.mamicode.com/"/test",method=RequestMethod.POST)> 

测试:

结果

{"user":{"name":null,"id":2,"password":"123456","avatar":null,"gender":0,"mobile":"15072370640","accessToken":"fd6bf3dd3cca4b0ca7c9099447994dba"}}