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

版权声明:本文为博主原创文章,未经博主允许不得转载。否则,吔屎伺候。 https://blog.csdn.net/guowujun321/article/details/79088508
最近接触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>

猜你喜欢

转载自blog.csdn.net/guowujun321/article/details/79088508