参考文章:http://www.cnblogs.com/hoojo/archive/2011/04/19/2020551.html
先解析fm的模板,没有到jsp模板中去找
freemarker.properties的内容与参考文章中的一样
在ftl页面中可以这样:
感觉用了easyui freemarker用武之地并不大,呵呵
先解析fm的模板,没有到jsp模板中去找
<!-- 设置freeMarker的配置文件路径 -->
<bean id="freemarkerConfiguration"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="location" value="classpath:freemarker.properties" />
</bean>
<!-- 配置freeMarker的模板路径 -->
<bean id="freemarkerConfig"
class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
<!--property name="freemarkerSettings" ref="freemarkerConfiguration"/ -->
<property name="templateLoaderPath">
<value>/WEB-INF/ftl/</value>
</property>
<property name="freemarkerVariables">
<map>
<entry key="xml_escape" value-ref="fmXmlEscape" />
</map>
</property>
</bean>
<bean id="fmXmlEscape" class="freemarker.template.utility.XmlEscape" />
<!-- 配置freeMarker视图解析器 -->
<bean id="fmviewResolver"
class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.freemarker.FreeMarkerView" />
<property name="contentType" value="text/html; charset=utf-8" />
<property name="cache" value="true" />
<property name="prefix" value="/WEB-INF/ftl" />
<property name="suffix" value=".ftl" />
<property name="order" value="1" />
</bean>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.JstlView</value>
</property>
<property name="prefix">
<value>/WEB-INF/views/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
<property name="order" value="2" />
</bean>
freemarker.properties的内容与参考文章中的一样
在ftl页面中可以这样:
<#assign ctx = pageContext.request.contextPath>
<#assign usr = sessionScope.CURRENT_USER>
<script type="text/javascript" src="${ctx}/resources/jquery.min.js"></script>
<script type="text/javascript" src="${ctx}/resources/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${ctx}/resources/locale/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" type="text/css" href="${ctx}/resources/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${ctx}/resources/themes/icon.css">
<link rel="stylesheet" type="text/css" href="${ctx}/resources/style.css">
感觉用了easyui freemarker用武之地并不大,呵呵