标签:col res over org 本地化 rop upd Servle root
<bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer"> <property name="templateLoaderPath" value="/WEB-INF/templates/"/> <property name="defaultEncoding" value="utf-8" /> <property name="freemarkerSettings"> <props> <prop key="template_update_delay">10</prop> <prop key="locale">zh_CN</prop> <prop key="datetime_format">yyyy-MM-dd</prop> <prop key="date_format">yyyy-MM-dd</prop> <prop key="number_format">#.##</prop> <prop key="auto_import">frame/base.ftl as base</prop> <prop key="auto_include">frame/base.ftl</prop> </props> </property> <!--设置一些常用的全局变量 --> <property name="freemarkerVariables"> <map> <entry key="xml_escape" value-ref="fmXmlEscape" /> <entry key="webRoot" value="/shop"></entry> <entry key="jsRoot" value="/shop/js"></entry> <entry key="xml_escape" value-ref="fmXmlEscape" /> </map> </property> </bean> <bean class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"> <property name="cache" value="true" /> <property name="suffix" value=".ftl" /> <property name="contentType" value="text/html;charset=UTF-8" /> <property name="viewClass" value="org.springframework.web.servlet.view.freemarker.FreeMarkerView" /> <property name="allowSessionOverride" value="true" /> <property name="allowRequestOverride" value="true" /> <property name="exposeSpringMacroHelpers" value="false" /> <property name="exposeRequestAttributes" value="true" /> <property name="exposeSessionAttributes" value="true" /> <property name="requestContextAttribute" value="request" /> <property name="order" value="0" /> </bean> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="" /> <property name="viewNames" value="*.html,*.jsp" /> <property name="suffix" value="" /> <property name="viewClass" value="org.springframework.web.servlet.view.InternalResourceView" /> <property name="order" value="1"></property> </bean>
freemarkerSettings全局配置:
其他详情参考setting配置:https://freemarker.apache.org/docs/api/freemarker/template/Configuration.html#setSetting-java.lang.String-java.lang.String-
freemarkerVariables全局变量设置:
FreeMarkerViewResolver:
标签:col res over org 本地化 rop upd Servle root
原文地址:https://www.cnblogs.com/lpob/p/10835824.html