如何将整数数组传递给弹簧控制器?

use*_*127 5 java jquery spring

的脚本Arrayint我希望传入Spring Controller. 但我不断得到

400 bad request.
Run Code Online (Sandbox Code Playgroud)

如果我js array

array = [1,2,3,4]
array -> 400 bad request
JSON.Stringify(array) -> I will get [1,2,3,4]

    $.ajax({//jquery ajax
                data:{"images": array},                
                dataType:'json',
                type:"post",
                url:"hellomotto"
                ....
            })
Run Code Online (Sandbox Code Playgroud)

当我循环string List.. 第一个元素将是'[1'

@RequestMapping(value = "/hellomotto", method = Request.POST)
public void hellomotto(@RequestParam("images") List<String> images){
 sysout(images); -> I will get [1,2,3,4]
}
Run Code Online (Sandbox Code Playgroud)

公共无效

我可以知道如何正确执行此操作吗?我尝试了不同的组合

map*_*apm 7

以下是一个工作示例:

Javascript:

$('#btn_confirm').click(function (e) {

    e.preventDefault();     // do not submit the form

    // prepare the array
    var data = table.rows('.selected').data();
    var ids = [];
    for(var i = 0; i < data.length; i++) { 
        ids.push(Number(data[i][0]));
    }

    $.ajax({
        type: "POST",
        url: "?confirm",
        data: JSON.stringify(ids),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(data){
            alert(data);
        },
        failure: function(errMsg) {
            alert(errMsg);
        }
    });
});
Run Code Online (Sandbox Code Playgroud)

控制器:

@RequestMapping(params = "confirm", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody int confirm(@RequestBody Long[] ids) {
    // code to handle request
    return ids.length;
}
Run Code Online (Sandbox Code Playgroud)