防止controller返回中文乱码

来源:互联网 发布:如何windows截屏 编辑:程序博客网 时间:2024/05/21 16:22
    <!-- 设定消息转换的编码为utf-8防止controller返回中文乱码 -->    <bean        class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">        <property name="messageConverters">            <list>                <bean                    class="org.springframework.http.converter.StringHttpMessageConverter">                    <property name="supportedMediaTypes">                        <list>                            <value>text/html;charset=UTF-8</value>                        </list>                    </property>                </bean>            </list>        </property>    </bean>