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

81314797 2012-12-29

<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>

相关推荐

89314493 / 0评论 2020-06-03