标签:
json前台写数据
@RequestMapping("/addUserJson") public void addUserJson(User user,HttpServletRequest request, HttpServletResponse response){ String result = "{\"userName\":\" "+ user.getUserName()+" \", \"age\":\" "+ user.getAge()+" \"}"; PrintWriter out = null; response.setContentType("application/json"); try { out=response.getWriter(); out.write(result); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
标签:
原文地址:http://www.cnblogs.com/wujixing/p/5603391.html