`

thymeleaf2+tiles2+spring4 乱码解决

阅读更多

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

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics