我建立的JS阵列和尝试通过阵列到控制器类中,但也有它表示NullPointerException
。
我通过萤火检查URL有值逝去,但控制器类,如果我尝试以检索它显示NULL。
JavaScript代码:
var deleteWidgetId = new Array(); //array created
deleteWidgetId[0] = "a";//adding values
deleteWidgetId[1] = "b";
//action trigged
$("#saveLayout").load("layout/saveLayout.action",
{ deleteWidgetId : deleteWidgetId },
function(response, status, xhr) { });
Java的代码(在控制器类):
@RequestMapping(value = "/saveLayout")
public ModelAndView saveLayout(@RequestParam String[] deleteWidgetId) throws Exception {
//here that if i try to use the deleteWidgetId it is giving null pointer exception
}