spring MVC之返回JSON数据(Spring3.0 MVC)

方式一:使用ModelAndView的contentType是"application/json"

方式二:返回String的            contentType是"text/html"

那么如何设置response的content type呢?

使用注解@RequestMapping 中的produces:

@RequestMapping(value = "/upload",produces="application/json;charset=UTF-8")
原文地址:https://www.cnblogs.com/wujixing/p/5799009.html