freemarker简单模板如下:

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
        <title>中文</title>
    </head>
    <body>
        <h1>${name}</h1>
        <h2>中文测试</h2>
    </body>
</html>

方案如下:

  • 设置模板文件本身的属性:右键文件,选择properties,看text file encoding 选择UTF-8编码。
  • 在头部加标签:<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  • request、response 设置编码格式为UTF-8。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
  • 2021-10-09
  • 2022-12-23
  • 2022-01-15
猜你喜欢
  • 2021-12-06
  • 2021-07-04
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
  • 2022-12-23
相关资源
相似解决方案