我正在对 jsp 页面进行 ajax 调用,如下所示:
jQuery.ajax({
url: 'update.jsp',
data: {testarray:[["j1_1", "", "Tab 1", ""],["j1_2", "j1_1", "Item 1", ""],["j1_3", "", "Tab 2", ""]]},
success: callback,
type: 'POST',
contentType: "application/x-www-form-urlencoded; charset=UTF-8;",
});
在 update.jsp 中,我尝试使用以下方法获取 testarray 参数的值:
String[] testArrayValue=request.getParameterValues('testarray');
System.out.println(testArrayValue);
控制台打印显示testArray值为null。 谁能将我引向正确的方向? 提前致谢, 安迪
最佳答案
更改:
request.getParameterValues('testarray');
致:
request.getParameterValues("testarray");
关于java - request.getParameterValues在jsp页面中获取null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30375550/