我这里是这样就解决了,当然.vm文件都是UTF-8
另外,在liferay下
我修改velocity.properties文件的file.resource.loader.path不起作用,只有resourceLoaderPath设置才生效,不知道为什么
路过知道的同学提点下吧
<bean id="velocityConfig"
class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
<property name="resourceLoaderPath" value="/WEB-INF/vm/"></property>
<property name="velocityProperties">
<props>
<prop key="output.encoding">UTF-8</prop>
<prop key="input.encoding">UTF-8</prop>
</props>
</property>
</bean>另外,在liferay下
我修改velocity.properties文件的file.resource.loader.path不起作用,只有resourceLoaderPath设置才生效,不知道为什么
路过知道的同学提点下吧
本文介绍了解决Velocity模板引擎中UTF-8编码问题的方法。通过正确配置Spring MVC中的VelocityConfigurer组件,并设置resourceLoaderPath及velocityProperties属性,确保输入输出均采用UTF-8编码。此外,还讨论了在Liferay环境下velocity.properties文件配置无效的情况。
762

被折叠的 条评论
为什么被折叠?



