方式一:使用ModelAndView的contentType是"application/json"
方式二:返回String的 contentType是"text/html"
那么如何设置response的content type呢?
使用注解@RequestMapping 中的produces:
@RequestMapping(value = "/upload",produces="application/json;charset=UTF-8")
时间: 2024-12-16 18:58:35