使用thymeleaf后,即使使用org.springframework.web.filter.CharacterEncodingFilter也不能解决中文乱码问题了,

  后来发现在org.thymeleaf.spring3.view.ThymeleafViewResolver有这个属性

  

 private String characterEncoding = null;

  猜想可能是 设置字符集

  于是:

  

    <bean class="org.thymeleaf.spring3.view.ThymeleafViewResolver">
        <property name="characterEncoding" value="utf-8"/>
        <property name="templateEngine" ref="templateEngine" />
    </bean>

  竟然顺利的解决了问题。

posted on 2015-07-06 12:55  大招无限  阅读(2019)  评论(0编辑  收藏  举报