日期:2014-05-16 浏览次数:20343 次
public ModelAndView ajaxTest(HttpServletRequest request, HttpServletResponse response)throws Exception{ response.setCharacterEncoding("utf-8"); String data=request.getParameter("data"); log.info(">>>>>>>>>data="+data); try { JSONObject jsonObj = new JSONObject(data); JSONArray jarr = (JSONArray) jsonObj.get("data"); for(int i=0;i<jarr.length();i++){ JSONObject jobj = (JSONObject)jarr.get(i); String name = null; String value = null; try{ name = (String)jobj.get("name"); value = (String)jobj.get("value"); log.info(">>>>"+name+"="+value); }catch(Exception jex){} } response.getWriter().write("{success:true,info:'"+ StringEscapeUtils.escapeJavaScript("保存成功!")+"'}"); } catch (Exception e) { response.getWriter().write("{success:false,info:'"+ StringEscapeUtils.escapeJavaScript(e.getMessage())+"'}"); } return null; }