我遇到了内页问题。它只是将页面识别为iso,但我想要utf-8,我将它声明为默认字符集。我尝试了对 freemarker 配置的一些修改,但它们没有效果。
spring-servlet.xml
<bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
<property name="templateLoaderPath" value="/WEB-INF/pages/"/>
</bean>
模板.html
<#macro page>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cemitério - Prefeitura Municipal de Maringá</title>
</head>
<body>
Usuários
<#nested/>
</body>
</html>
</#macro>
登录.html
<#import "templates/template.html" as t/>
<@t.page>
<#if erroLogin??>
${erroLogin}
</#if>
<form action="entrar" method="post">
<div>
<label>Usuário:</label>
<input type="text" name="usuario" />
<br />
<label>Senha:</label>
<input type="text" name="senha" />
<br />
<input type="submit" name="submit" />
</div>
</form>
</@t.page>
输出