码迷,mamicode.com
首页 > Web开发 > 详细

json转义字符串

时间:2016-06-21 14:01:22      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:

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();
  }
} 

  

json转义字符串

标签:

原文地址:http://www.cnblogs.com/wujixing/p/5603391.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!