拦截器如下:
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { PrintWriter writer=response.getWriter(); response.setContentType("applicatio优艾设计网_Photoshop论坛n/json;charset=UTF-8"); response.setCharacterEncoding("UTF-8"); writer.println("{"language":"简体中文"}"); writer.flush(); writer.close(); return false; }
上面返回时,中文只显示几个问号。Controller里返回的中文是不会乱码的。什么回事呢?
精彩评论