将Ember数据从Ember发送到Spring

时间:2016-01-26 11:38:51

标签: jquery json rest

我尝试将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);
}

0 个答案:

没有答案