标签:
1、在lib中加入jackson.jar包
2、在请求函数上进行标注返回类型,ResponseBody也可以放上边
@RequestMapping(value="/json",method=RequestMethod.GET, produces="application/json;charset=UTF-8") public @ResponseBody User getUserJson(){ User user = new User(); user.setId(12); user.setName("zhangsan"); return user; }
标签:
原文地址:http://www.cnblogs.com/hpustudent/p/4318670.html