AJAX を使用して Web ブラウザーの JavaScript から Spring MVC コントローラーに配列を渡したい
JavaScriptでは、私は持っています
var a = [];
a[0] = 1;
a[1] = 2;
a[2] = 3;
// how about multiple arrays as well?
$.ajax({
type : "POST",
url : "/myurl",
data : //not sure how to write this, ("a="+a), ?
success : function(response) {
// do something ...
},
error : function(e) {
alert('Error: ' + e);
}
});
JavaでAJAXからデータを受け取るクラスを作成したいのですが、データを受け取るクラスを作成します
package com.amazon.infratool.ui;
import lombok.Getter;
import lombok.Setter;
@Setter @Getter
public class RepairInfomationParameters {
//how to write this variable?
List<String> a = null; // is it something like this?
}
これを行う正しい方法は何ですか?ありがとう!