使用springMVC框架,controller类post方法接收实体bean对象参数时常用两种方式@RequestBody和@ModelAttribute:
1、参数前为:@RequestBody
fiddler配置:
POST请求头:
Content-Type: application/json
User-Agent: Fiddler
Accept-Language: zh-CN,zh;q=0.8
X-Requested-With: XMLHttpRequest
Host: localhost:8080
Content-Length: 44
Request Body:
{"mobile":"xxxxxxxxxxx","password":"123456"}
2、参数前为:@ModelAttribute
fiddler配置:
POST请求头:
Content-Type: application/x-www-form-urlencoded
User-Agent: Fiddler
Accept-Language: zh-CN,zh;q=0.8
X-Requested-With: XMLHttpRequest
Host: localhost:8080
Content-Length: 34
Request Body:
mobile=xxxxxxxxxxx&password=123456