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")

 

posted @ 2016-08-23 13:43  wujixing909  阅读(199)  评论(0编辑  收藏  举报