日期:2014-05-16 浏览次数:20499 次
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" > <property name="messageConverters"> <list> <bean class = "org.springframework.http.converter.StringHttpMessageConverter"> <property name = "supportedMediaTypes"> <list> <value>text/plain;charset=UTF-8</value> </list> </property> </bean> </list> </property> </bean> <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
@ResponseBody @RequestMapping(value = "xxx",method = RequestMethod.GET) public String method(HttpServletRequest request, HttpServletResponse response){ ..... response.setContentType("text/html;charset=UTF-8"); response.getWriter().print(你的json.toString()); return null; }