There are a few steps that are modified in the spring Web [sevlet-name]-servlet.xml file to:
Boldface fonts are key, others are configured according to your situation:
<!--========================= VIEW definitions =========================--
<bean id= "Velocityviewresolver" class= "Org.springframework.web.servlet.view.velocity.VelocityViewResolver" >
<property name= "suffix" value= ". VMs" ></property>
<property name= "ContentType" ><value>text/html;charset=UTF-8</value></property>
</bean>
<bean id= "Velocityconfigurer" class= "Org.springframework.web.servlet.view.velocity.VelocityConfigurer" >
<property name= "Resourceloaderpath" >
<value>${pgallery.template}</value>
</property>
<property name= "Velocityproperties" >
<props>
<prop key= "Input.encoding" >utf-8</prop>
<prop key= "Output.encoding" >utf-8</prop>
</props>
</property>
</bean>
Note:
First of all, to ensure that the development environment of the file encoding unified, the jsp/html character encoding is declared as Utf-8.
Spring Velocity Chinese garbled solution