coupon

coupon-parent

freemarker

引用的包 xxx-freemaker-view

自定义标签

1
2
3
4
5
6
7
<@block>

<@extends>

<@override>

<@super>

xml文件配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!-- 资源文件配置 -->
<mvc:resources mapping="/resources/**" location="/config"/>
<!-- freeMarker 配置开始 -->
<mvc:resources mapping="/js/**" location="/static/js/" />
<mvc:resources mapping="/css/**" location="/static/css/" />
<mvc:resources mapping="/img/**" location="/static/img/" />
<mvc:resources mapping="/font/**" location="/static/font/" />
<mvc:resources mapping="/fonts/**" location="/static/font/" />

<!-- freeMarker 环境配置 -->
<bean id="freeMarkerConfigurer" class="com.xxx.web.view.ViewConfigurer">
<property name="templateLoaderPath" value="/WEB-INF/views/" />
<property name="defaultEncoding" value="UTF-8" />
<property name="freemarkerSettings">
<props>
<prop key="template_update_delay">0</prop>
<prop key="datetime_format">yyyy-MM-dd HH:mm:ss</prop>
<prop key="date_format">yyyy-MM-dd</prop>
<prop key="number_format">#.##</prop>
<prop key="auto_import">/common/common.ftl as spring</prop>
</props>
</property>
</bean>

<!-- 定义freeMarker视图解析器-->
<bean id="freeMarkerViewResolver" class="com.xxx.web.view.ViewPageResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.freemarker.FreeMarkerView" />
<property name="suffix" value=".ftl" />
<property name="contentType" value="text/html;charset=UTF-8" />
<property name="exposeRequestAttributes" value="true" />
<property name="exposeSessionAttributes" value="true" />
<property name="viewStaticMethod" ref="staticMethod" />
</bean>

<bean id="staticMethod" class="com.xxx.web.view.ViewStaticMethod">
<property name="classList">
<list>
<value>com.xxx.web.utils.UrlUtil</value>
<value>com.xxx.web.utils.DebugUtil</value>
<value>com.xxx.web.utils.HtmlUtil</value>
</list>
</property>
</bean>
<!-- freeMarker 配置结束 -->

0%