欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

thymeleaf2+tiles2+spring4 乱码解决

程序员文章站 2022-04-07 14:33:23
...

需要在两个地方设置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");

 

相关标签: thymeleaf spring4

上一篇: ES6新特性

下一篇: python异常处理