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

ObjectMapper 返回json 串

时间:2014-11-28 15:45:27      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:http   io   ar   sp   on   as   new   tt   res   

@RequestMapping(value="getCountyBycityId")
public void getCountyBycityId(HttpServletRequest request,HttpServletResponse response) throws Exception{
Long cityId = Long.parseLong(request.getParameter("cityId"));
ObjectMapper mapper = new ObjectMapper();
List<CrmProvinceCity> list = creditContractService.getCountyBycityId(cityId);
String jsonString = mapper.writeValueAsString(list);
response.setContentType("text/json;charset=utf-8");
response.getWriter().print(jsonString);
}

ObjectMapper 返回json 串

标签:http   io   ar   sp   on   as   new   tt   res   

原文地址:http://www.cnblogs.com/yy123/p/4128420.html

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