0

我有一个 jQuery ajax 调用:

  $("tr." + trClassName).each(function() {                
     list1.push(some Id from td);
     list2.push(some id from another td);
});

// 这里list1list2就像 {1,2,3,4,...}

$.ajax({
    type : "GET",
    url : "./bulkUpdate" ,
    data : "id=" + id + "&list1=" +list1+ "&list2=" + list2,
    success : function(response) {
        alert("Dispaly orders updated successfully");
    },
    error : function(e) {
        alert('Error: ' + e);
    }
});

现在在控制器中,我的接收器代码为:

   @RequestMapping(value = "/bulkUpdate", method = RequestMethod.GET)
   public @ResponseBody String updateOrders(@ModelAttribute(value = "content") Content content) {

       // **Content** class has attributes for **list1** and **list2**
       // here i am getting the correct data like:

       List<String> list1= content.getList1();
       List<String> list2= content.getList2();

       /* do something */

       return "success";
    }

一切正常,但它总是返回

error : function(e) {
    alert('Error: ' + e);
}

在火灾错误中,我收到以下错误:

*"NetworkError: 404 Not Found - http://localhost:8080/web-pack/tool/languageTool/bulkUpdate?id=1&list1=8,9,10,11,13,105,129,132,12,135,134&list2=8,9,10,11,14,15,16,17,18,19,20*
4

2 回答 2

0

您是否已通过 ViewResolver 创建并加载了 success.jsp 视图?

我认为您很困惑,如果您只想响应“成功”字符串,请直接使用 HttpServletResponse.getWriter() 来完成。

于 2013-11-07T06:48:46.130 回答
0
List<String> List2= content.getList2();
int counter = 0;
for (String id1: content.getList1()) {

  sysout(id1 + List2.get(counter));
  counter ++
}
于 2013-11-07T06:17:55.120 回答