【发布时间】:2013-07-07 18:28:44
【问题描述】:
我想使用 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?
}
这样做的正确方法是什么?谢谢!
【问题讨论】:
标签: javascript jquery ajax arrays spring-mvc