_xkoko
COCO 很懒 什么都没留下......

 

后台方法返回值出现乱码

 

JSONObject json=new JSONObject();

json.put("totals1",map);

 return json.toJSONString();

 

如图

 

 解决办法:在Spring-MVC.xml配置文件添加以下配置,然后直接返回要生成Json串的对象 

<mvc:annotation-driven>
<mvc:message-converters register-defaults="true">
<bean id="stringHttpMessageConverter" class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes" value="application/json;charset=UTF-8"/>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>

 

posted on 2019-02-27 14:33  _xkoko  阅读(3076)  评论(0编辑  收藏  举报