Hello?
I changed some codes.
Please check the below files
My questions are so simple regarding these files.
I want to know how to set the value of the URL of Ajax from pqGrid.
It really is difficult to match each other.
from product.jsp
$.ajax({
dataType: "json",
type: "POST",
async: true,
beforeSend: function (jqXHR, settings) {
grid.showLoading();
},
url: "/aa/products/batch", //for ASP.NET, java
data: { list: JSON.stringify(changes) },
to productController.java
@RequestMapping(value="/Products/clear", method=RequestMethod.GET)
public @ResponseBody String clear(HttpServletRequest request ){
HttpSession ses = fillInSession(request);
//ses.setAttribute("Products", "");
@SuppressWarnings("unchecked")
List<Products> Products = (List<Products>)ses.getAttribute("Products");
Products.clear();
return "";
}
@RequestMapping(value="/Products/batch", method=RequestMethod.POST)
public @ResponseBody String batch(@RequestParam String list, HttpServletRequest request ){
HttpSession ses = fillInSession(request);
Map<String, List<Products>> dlist = deserializeMap(list);
ArrayList<Products> updateList = (ArrayList<Products>)dlist.get("updateList");
ArrayList<Products> addList = (ArrayList<Products>)dlist.get("addList");
ArrayList<Products> deleteList = (ArrayList<Products>)dlist.get("deleteList");
this.updateList(updateList, ses);
this.addList(addList, ses);
this.deleteList(deleteList, ses);
return serializeMap(dlist);
}
@RequestMapping(value="/Products/get",method=RequestMethod.GET)
public @ResponseBody String Products(ModelMap model, HttpServletRequest request ){
HttpSession ses = fillInSession(request);
@SuppressWarnings("unchecked")
List<Products> products = (List<Products>)ses.getAttribute("Products");
String serializedProducts = serialize(products);
String responseStr = "{\"data\":" + serializedProducts + "}";
return responseStr;
}