我尝试将Jmber数据从我的Ember应用程序发送到Spring REST应用程序,但是在Spring控制台中我看到:
json = %7B%22username%22%3A%22userTest%22%2C%22password%22%3A%22passwordTest%22%7D=
此POST请求有什么问题?
create() {
var _this = this;
var userData = {
"username": "userTest",
"password": "passwordTest"
};
$.ajax({
type: "POST",
url: 'http://localhost:8080/createUser',
dataType: 'json',
async: false,
data: JSON.stringify(userData),
})
}
Spring控制器
@RequestMapping(value="/createUser", method = RequestMethod.POST)
@ResponseBody
public void test(@RequestBody String user) {
System.out.println("json = " + user);
}