当前位置:首页 > 开发 > 系统架构 > 架构 > 正文

thymeleaf2+tiles2+spring4 乱码解决

发表于: 2015-05-02   作者:cuizhihua   来源:转载   浏览:
摘要: 需要在两个地方设置UTF-8编码才可以: 第一个地方是  org.thymeleaf.spring4.view.AjaxThymeleafViewResolver.MvcViewFactoryCreator factoryCreator = new MvcViewFactoryCreator(); AjaxThymeleafViewResolver atvr = this.we

需要在两个地方设置UTF-8编码才可以:

第一个地方是 

org.thymeleaf.spring4.view.AjaxThymeleafViewResolver.MvcViewFactoryCreator factoryCreator = new MvcViewFactoryCreator();
		AjaxThymeleafViewResolver atvr = this.webMvcConfig.tilesViewResolver();
		atvr.setCharacterEncoding("UTF-8");
		atvr.setContentType("text/html; charset=utf-8");

 第二个地方是

org.thymeleaf.templateresolver.ServletContextTemplateResolver.ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
		templateResolver.setCharacterEncoding("UTF-8");

 

thymeleaf2+tiles2+spring4 乱码解决

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号