天天看点

关于struts2下,velocity模板中文乱码的问题。

最近接触velocity,发现vm模板会出现中文乱码情况。velocity.properties 文件也配置了

input.encoding=UTF-8
output.encoding=UTF-8
           

 但没效果,依旧乱码。struts.xml里也配置了

<constant name="struts.i18n.encording" value="UTF-8"></constant>
           

然而,并没什么卵用,其实只需在vm文件里加入

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
           

即可,如下:

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
    <title>登录</title>
</head>
           

继续阅读