<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">

<!-- FreeMarker视图解析 如返回student。。在这里配置后缀名htm和视图解析器。。 -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.freemarker.FreeMarkerView" />
<property name="suffix" value=".html" />
<property name="contentType" value="text/html;charset=UTF-8" />
<property name="exposeRequestAttributes" value="true" />
<!-- 不开启session -->
<property name="exposeSessionAttributes" value="false" />
<property name="requestContextAttribute" value="request"/>
<!-- 使用Spring提供的FreeMarker宏 -->
<property name="exposeSpringMacroHelpers" value="true" />
</bean>
<!-- freemarker的配置 -->
<bean id="freemarkerConfigurer"
class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
<property name="templateLoaderPath" value="/WEB-INF/inborn" />
<property name="defaultEncoding" value="UTF-8" />
<property name="freemarkerSettings">
<props>
<!-- 用来指定更新模版文件的间隔时间,相当于多长时间检测一下是否有必要重新加载模版文件, 0 表示每次都重新加载,否则为多少毫秒钟检测一下模版是否更改
2147483647 -->
<prop key="template_update_delay">0</prop>
<prop key="locale">zh_CN</prop>
<prop key="defaultEncoding">UTF-8</prop>
<prop key="url_escaping_charset">UTF-8</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="whitespace_stripping">true</prop>
<!--空值处理 -->
<prop key="classic_compatible">true</prop>
<prop key="boolean_format">true,false</prop>
</props>
</property>
<property name="freemarkerVariables">
<map>
<entry key="moneyShow" value-ref="moneyFre"/>
<entry key="moneyGroup" value-ref="moneyFormat"/>
<entry key="friendlyLength" value-ref="lengthFre"/>
<entry key="timeFormat" value-ref="timeFre"/>
<entry key="title" value="胤宝"/>
<entry key="monyType" value="¥"/>
</map>
</property>
</bean>

<!-- 自定义金额标签 -->
<!-- 自定义金额标签 -->
<bean id="moneyFre" class="com.inborn.inshop.freemarker.MoneyFre"></bean>
<bean id="moneyFormat" class="com.inborn.inshop.freemarker.MoneyFormat"></bean>
<bean id="lengthFre" class="com.inborn.inshop.freemarker.LengthFre"></bean>
<bean id="timeFre" class="com.inborn.inshop.freemarker.TimeFre"></bean>

</beans>

spring配置freemarker的更多相关文章

  1. spring整合freemarker

    一.配置maven <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www ...

  2. spring整合freemarker 自定义标签

    1.自定义标签实现 TemplateDirectiveModel 接口 2.spring 配置,注意标红的两行 <bean id="freemarkerConfig" cla ...

  3. Spring整合freemarker发送邮件

    转载:http://blog.csdn.net/zdp072/article/details/32745335 分类: freemarker spring 2014-06-20 23:39 752人阅 ...

  4. struts2+hibernate+spring配置版框架搭建以及简单测试(方便脑补)

    为了之后学习的日子里加深对框架的理解和使用,这里将搭建步奏简单写一下,目的主要是方便以后自己回来脑补: 1:File--->New--->Other--->Maven--->M ...

  5. spring boot+freemarker+spring security标签权限判断

    spring boot+freemarker+spring security标签权限判断 SpringBoot+SpringSecurity+Freemarker项目中在页面上使用security标签 ...

  6. Spring MVC freemarker使用

    什么是 FreeMarker? FreeMarker 是一款 模板引擎: 即一种基于模板和要改变的数据, 并用来生成输出文本(HTML网页,电子邮件,配置文件,源代码等)的通用工具. 它不是面向最终用 ...

  7. Spring Boot Freemarker特别篇之contextPath【从零开始学Spring Boot】(转)

    需求缘起:有人在群里@我:请教群主大神一个问题,spring boot  + freemarker 怎么获取contextPath 头疼死我了,网上没一个靠谱的 .我就看看之前博客中的 [Spring ...

  8. Spring Boot Freemarker特别篇之contextPath【从零开始学Spring Boot

      需求缘起:有人在群里@我:请教群主大神一个问题,spring boot  + freemarker 怎么获取contextPath 头疼死我了,网上没一个靠谱的 .我就看看之前博客中的 [Spri ...

  9. Spring MVC + freemarker实现半自动静态化

    这里对freemarker的代码进行了修改,效果:1,请求.do的URL时直接生成对应的.htm文件,并将请求转发到该htm文件2,自由控制某个页面是否需要静态化原理:对org.springframe ...

随机推荐

  1. 20165305 苏振龙《Java程序设计》第五周学习总结

    第七章 Java支持在一个类中声明另一个类,这样的类称作内部类,而包含内部类的类成为内部类的外嵌类. 和某类有关的匿名类就是该类的一个子类,该子类没有明显的用类声明来定义,所以称做匿名类. 和某接口有 ...

  2. Mysql相关技术细节整理

    一.错误日志相关 1.mysql错误日志所在位置 windows下,错误日志文件一般在安装目录下的data目录下.扩展名是.err的文件,也可以打开安装目录下的my.ini文件检查一下linux下,错 ...

  3. mac电脑设置USB键盘按键方法,设置多显示屏镜像显示器的方法

    mac电脑设置USB键盘按键方法,设置多显示屏镜像显示器的方法 设置多显示屏镜像显示器的方法 ==================== mac电脑复制粘贴使用command+c command+v - ...

  4. 新浪微博 [异常问题] 414 Request-URL Too Large

    新浪微博 [异常问题] 414 Request-URL Too Large 浏览器上打开新浪微博,或则日志是返回结果提示:414 Request-URL Too Large原因:因同IP访问微博页面过 ...

  5. hdu 1466 计算直线的交点数 递推

    题目描述 平面上有n条直线,且无三线共点,问这些直线能有多少种不同交点数. 比如,如果n=2,则可能的交点数量为0(平行)或者1(不平行). 输入 输入数据包含多个测试实例,每个测试实例占一行,每行包 ...

  6. PHP json_encode函数中需要注意的地方

    在php中使用 json_encode() 内置函数可以使用得php中的数据更好的与其它语言传递与使用. 这个函数的功能是将数组转换成json数据存储格式: 1 <?php 2 $arr=arr ...

  7. GoldenGate实时投递数据到大数据平台(2)- Cassandra

    简介 GoldenGate是一款可以实时投递数据到大数据平台的软件,针对apache cassandra,经过简单配置,即可实现从关系型数据将增量数据实时投递到Cassandra,以下介绍配置过程. ...

  8. 知乎上一个比较好的学习QT的公众号<<跟小豆君学Qt>>

    公众号网址:https://zhuanlan.zhihu.com/p/28472916

  9. CentOS 4.8/OEL4.8 配置本地yum

    下载createrepo包并安装 下载地址: ftp://195.220.108.108/linux/dag/redhat/el4/en/i386/dag/RPMS/createrepo-0.4.6- ...

  10. RHEL6/7 x86_64下cachefilesd占用cpu达到100%

    昨天,有个测试环境cachedfilesd CPU 100%,一直在跑了挺久,经查 1. CacheFiles介绍NFS是一种经常使用到的网络共享文件系统,在分布式环境下,多台服务器的文件共享是一个问 ...