spring配置freemarker
<?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的更多相关文章
- spring整合freemarker
一.配置maven <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www ...
- spring整合freemarker 自定义标签
1.自定义标签实现 TemplateDirectiveModel 接口 2.spring 配置,注意标红的两行 <bean id="freemarkerConfig" cla ...
- Spring整合freemarker发送邮件
转载:http://blog.csdn.net/zdp072/article/details/32745335 分类: freemarker spring 2014-06-20 23:39 752人阅 ...
- struts2+hibernate+spring配置版框架搭建以及简单测试(方便脑补)
为了之后学习的日子里加深对框架的理解和使用,这里将搭建步奏简单写一下,目的主要是方便以后自己回来脑补: 1:File--->New--->Other--->Maven--->M ...
- spring boot+freemarker+spring security标签权限判断
spring boot+freemarker+spring security标签权限判断 SpringBoot+SpringSecurity+Freemarker项目中在页面上使用security标签 ...
- Spring MVC freemarker使用
什么是 FreeMarker? FreeMarker 是一款 模板引擎: 即一种基于模板和要改变的数据, 并用来生成输出文本(HTML网页,电子邮件,配置文件,源代码等)的通用工具. 它不是面向最终用 ...
- Spring Boot Freemarker特别篇之contextPath【从零开始学Spring Boot】(转)
需求缘起:有人在群里@我:请教群主大神一个问题,spring boot + freemarker 怎么获取contextPath 头疼死我了,网上没一个靠谱的 .我就看看之前博客中的 [Spring ...
- Spring Boot Freemarker特别篇之contextPath【从零开始学Spring Boot
需求缘起:有人在群里@我:请教群主大神一个问题,spring boot + freemarker 怎么获取contextPath 头疼死我了,网上没一个靠谱的 .我就看看之前博客中的 [Spri ...
- Spring MVC + freemarker实现半自动静态化
这里对freemarker的代码进行了修改,效果:1,请求.do的URL时直接生成对应的.htm文件,并将请求转发到该htm文件2,自由控制某个页面是否需要静态化原理:对org.springframe ...
随机推荐
- 【Linux学习二】文件系统
环境 虚拟机:VMware 10 Linux版本:CentOS-6.5-x86_64 客户端:Xshell4 FTP:Xftp4 一.文件系统 一切皆文件Filesystem Hierarchy St ...
- Linux基础命令---切换用户su
su 临时切换身份到另外一个用户,使用su切换用户之后,不会改变当前的工作目录,但是会改变一些环境变量. 此命令的适用范围:RedHat.RHEL.Ubuntu.CentOS.SUSE.openSUS ...
- Linux查看磁盘空间大小命令
Linux查看磁盘空间大小命令df -hldf -hl 查看磁盘剩余空间df -h 查看每个根路径的分区大小du -sh [目录名] 返回该目录的大小du -sm [文件夹] 返回该文件夹总M数du ...
- windows下cmd清屏命令cls
windows下cmd清屏命令cls
- 怎样从外网访问内网微服务Microservices?
本地部署了一个微服务,只能在局域网内访问,怎样从外网也能访问到本地的微服务呢?本文将介绍具体的实现步骤. 准备工作 部署并启动微服务程序 默认部署的微服务端口是8088. 实现步骤 下载并解压hole ...
- Linux下的Jmeter运行测试
本文主要介绍Jmeter脚本如何在Linux通过no GUI的方式运行.总共分三部分: 1.Linux下JDK的安装及环境变量的配置 2.Linux下Jmeter的安装及环境变量的配置 3.运行结果的 ...
- org.springframework.dao.DuplicateKeyException
org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [insert into account v ...
- chrome platform
folder_extension: ---menifest.json ---navigator_change.js manifest.json { "manifest_version&quo ...
- mysql union 和 left join 结合查询用法
union 和 left join 结合查询用法 SELECT u.nickname,z.group_comming_type,z.id,z.user_id,z.title,z.create_time ...
- 【题解】 Luogu CF375D Tree and Queries
原题传送门 这道题要用树链剖分,我博客里有对树链剖分的详细介绍 我博客中对莫队的详细介绍 莫队好题 我一上来想写线段树,随后觉得不好写并弃坑 我们可以看见没有修改操作,钦定莫队 但这是在树上,所以不能 ...