- am I full of question marks in Chinese when I integrate Springmvc and freemarker?
- this is an error screenshot
- Code presentation
@ Bean
public FreeMarkerConfigurer freeMarkerConfigurer () {
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
configurer.setDefaultEncoding("UTF-8");
configurer.setTemplateLoaderPath("/WEB-INF/views/");
return configurer;
}
@ Bean
public FreeMarkerViewResolver freeMarkerViewResolver () {
FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
resolver.setCache(true);
resolver.setContentType("text/html;charset=UTF-8");
resolver.setPrefix("/WEB-INF/views/");
resolver.setSuffix(".ftl");
resolver.setExposeContextBeansAsAttributes(true);
resolver.setOrder(1);
return resolver;
}
this is the content of the page:
<html>
<head>
<title>FindIt</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<link href=/public-resources/css/bootstrap/bootstrap.css rel="stylesheet" />
</head>
<body>
<-sharpinclude "header.ftl">
<h1>Hello World! </h1>
<-sharpinclude "footer.ftl">
</body>
</html>
and all my files and projects are in utf-8 format.
4. I"ve tried almost everything I"ve seen online, but I"ve annotated the configuration, and I rarely see similar configurations.