spring-mvc 配置freemarker视图

<!-- 配置freeMarker的模板路径 -->
    <bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
        <property name="templateLoaderPath">
        <value>/WEB-INF/ftl/</value>
        </property>
        <property name="freemarkerVariables">
        <map>
            <entry key="xml_escape" value-ref="fmXmlEscape" />
        </map>
        </property>
        <property name="defaultEncoding">
            <value>utf-8</value>
        </property>
        <property name="freemarkerSettings">
            <props>
                <prop key="template_update_delay">3600</prop>
            </props>
        </property>
    </bean>

    <bean id="fmXmlEscape" class="freemarker.template.utility.XmlEscape"/>

你可能感兴趣的:(spring-mvc 配置freemarker视图)