Tag: 类型转换

通过Ajax调用使用Struts 2的HTTP数组参数

我在向Struts 2动作类发送数组参数时遇到问题。 我正在使用struts 2.1.8.1。 这是一些示例代码: public class MyAction extends ActionSupport { private String[] types; public String execute() { return SUCCESS; } public String[] getTypes() { return types; } public void setTypes(String[] types) { this.types = types; } } 问题是通过jquery ajax方法发送数组时: $.ajax({ type: ‘POST’, url: ‘Myaction.action’, data: { types: [“this”, “is”, “a”, “test”] } }); 导致exception发生: […]