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>
转载于:https://www.cnblogs.com/lvgg/p/6655355.html
spring配置freemarker相关推荐
- Spring配置笔记
##Spring 的简述 1. XML配置 在Spring1.x版本,使用Spring开发全部都是XML配置的Bean,随着项目的扩大,我们经常需要XML文件分别放在不同的配置文件中,需要频繁的将类和 ...
- Spring整合FreeMarker本地化动态设置
Spring整合FreeMarker进行国际化的过程很简单,将spring-webmvc里的org/springframework/web/servlet/view/freemarker下的sprin ...
- 一个完整的Spring+Hibernate+FreeMarker系统搭建过程
第一步 先新建一个WEB工程:导入相当的JAR包(我这里用的是Spring3.0,Hibernate-3.3,FreeMarker-2.3),这个就不用我多说了吧,相信大家都知道. 第二步 配置数据库 ...
- Spring boot Freemarker 获取ContextPath的方法
Spring boot Freemarker 获取ContextPath的两种方法: 1.自定义viewResolver,Spring boot中有一个viewResolver,这个和配置文件中的师徒 ...
- Spring 配置JNDI(连接池)
1. 找到Tomcat6.0安装目录下conf文件夹里的context.xml文件, 然后打开context.xml,在标签<context></<context>之间加 ...
- Spring配置iBatis多个SqlMapConfig.xml
Spring粘合iBatis的时候需要配置iBatis的SqlMapConfig.xml 对于项目多个模块而又想同时能管理起来,普遍的单个SqlMapConfig.xml就会显得臃肿 可喜的是Spri ...
- Spring 配置标签——util标签
Spring 配置标签--util标签 一.配置applicationContext.xml <beans xmlns="http://www.springframework.org/ ...
- spring mvc + freemarker 整合
<?xml version="1.0" encoding="UTF-8" ?> <beans xmlns="http://www.s ...
- spring配置c3p0连接池、spring的声明式事务管理
一.spring配置c3p0连接池: 1.导入maven依赖: <!-- https://mvnrepository.com/artifact/com.mchange/c3p0 --> & ...
最新文章
- 关于C#中编译器保证变量必须初始化规则猜想
- Spring Boot 2.x整合Quartz
- 【编程题目】求二叉树中节点的最大距离
- ElasticSearch配置扩展分词
- 基于物品的协同过滤推荐算法_《推荐系统实践》3.基于物品的协同过滤算法
- adfs服务器获取信息失败,在ADFS服务器上SAML LogOutRequest处理失败
- 《深入浅出数据分析》
- QWidget_层级关系
- 寄存器的偏移地址是什么意思?还有基地址,偏移地址就是相对于及地址的offset
- MacBook如何安装双系统?
- Apache配置反向代理
- 2018.9.13 贷款月供计算器
- 分式化简结果要求_中考分式化简求值题题型归纳
- 研发大局观(15.8.25 )
- R 加权最小二乘 代码_如何用EXCEL的规划求解功能优化投资组合的阿尔法值(最小二乘估计法)?...
- 保险保费基本计算规则
- cocos2dx入门1:关于Cocos Creator
- ngrock内网穿透(Ngrok 和 Sunny-Ngrok )
- C语言之运算符练习题
- 云主机的优势有哪些?
热门文章
- 四种依恋类型_依恋类型的四种模式影响着我们的亲密关系
- [概念型] 区块链包含术语概念【27术语整理汇总】
- nginx安装路径,查找配置文件以及如何配置
- python【力扣LeetCode算法题库】169-多数元素
- linux查找maven安装目录_Linux 安装 maven
- spss相关性分析看结果_利用spss做Pearson相关性分析步骤详解
- mysql服务在tcp6_为什么 netstat 对某些服务只显示了 tcp6 监听端口
- (5.1) Tomcat 8 源码, 实例化组件
- python语言1010的八进制_python打印十六进制
- 1235813找规律第100个数_拓展提优 | 小学数学拓展提优专项训练第9讲: