//將須要的參數轉成json字符串,而後用utf-8編碼 var obj = encodeURIComponent(JSON.stringify(this.categories),"utf-8")
//後臺將前臺的json字符串按照utf-8的格式解碼,而後進行轉換 @RequestMapping(value = "/updateMaterialDemoInfo.do", method = RequestMethod.POST) @ResponseBody public Map<String, Object> updateMaterialDemoInfo(String obj){ List<MaterialDemoInfoDTO> list = new ArrayList<MaterialDemoInfoDTO>(); try { String param = URLDecoder.decode(obj,"utf-8"); list = (List<MaterialDemoInfoDTO>)JSonUtil.json2Obj(param, MaterialDemoInfoDTO.class); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return materialDemoService.updateMaterialDemoInfo(list); }
public class MaterialDemoInfoDTO { // 主鍵ID private String id; //路徑 private String [] path; //物資器材模板id private String demoId; //數量 private String num; //序號 private String sort; //類型備註 private String remark;