SpringMVC3.2集成Freemarker时的中文乱码问题

<bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
      <property name="templateLoaderPath" value="/WEB-INF/ftl/"/>
      <!--注意这一行-->
      <property name="defaultEncoding" value="utf-8" />
</bean>

<bean id="viewResolver"
    	class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver" >
	<property name="cache" value="true"/>
	<property name="prefix" value=""/>
	<property name="suffix" value=".ftl"/>
        <!--注意这一行-->
	<property name="contentType" value="text/html; charset=utf-8"/>
    </bean>
</beans>

相关推荐