- <context:property-placeholder location="classpath:config.properties" ignore-unresolvable="true"/>
- <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>
- <property name="templateLoaderPath" value="/WEB-INF/view/"/>
- <property name="freemarkerVariables">
- <map>
- <entry key="xml_escape" value-ref="fmXmlEscape" />
- <entry key="webRoot" value="${webRoot}"></entry>
- <entry key="jsRoot" value="${jsRoot}"></entry>
- </map>
- </property>
- </bean>
- <bean id="fmXmlEscape" class="freemarker.template.utility.XmlEscape" />
config.properties文件:
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc\:mysql\://127.0.0.1\:3306/test?useUnicode\=true&characterEncoding\=utf8
jdbc.username=root
jdbc.password=root
webRoot=http\://127.0.0.1\:8080/freemarker/
jsRoot=${webRoot}resources/
freemarker.properties文件
tag_syntax=auto_detect
template_update_delay=60
default_encoding=UTF-8
output_encoding=UTF-8
locale=zh_CN
date_format=yyyy-MM-dd
time_format=HH:mm:ss
datetime_format=yyyy-MM-dd HH:mm:ss
ftl页面引用全局变量:
- <script type="text/javascript" src="${jsRoot}jquery-1.4.2.min.js"></script>
相关推荐
Spring MVC配置Freemarker全局变量,实现应用全路径
spring MVC + freeMarker spring MVC + freeMarker spring MVC + freeMarker
源码 博文链接:https://lavafree.iteye.com/blog/1096699
1、基于springboot+mvc+freemarker+aop实现校友信息管理系统源码.zip 2、该资源包括项目的全部源码,下载可以直接使用! 3、本项目适合作为计算机、数学、电子信息等专业的课程设计、期末大作业和毕设项目,作为参考...
基于springboot+mvc+freemarker+aop实现校友信息管理系统.zip基于springboot+mvc+freemarker+aop实现校友信息管理系统.zip基于springboot+mvc+freemarker+aop实现校友信息管理系统.zip基于springboot+mvc+freemarker...
spring mvc +freemarker不错的mvc搭配 原文: http://lavafree.iteye.com/blog/1096699 一、原来的程序有问题,导致maven无法编译运行。修改后解决了maven无法编译打包运行的问题,运行通过。 1.pom.xml 增加了必需的...
spring mvc freemarker 简单例子
Spring3MVC以Freemarker作展示层简单示例
spring mvc freemarker 自定义标签demo spring mvc 通过自定义的标签在jsp页面调用,初学,记录下做个备忘
Spring 3 mvc + Freemarker 的例子
NULL 博文链接:https://bijian1013.iteye.com/blog/2259056
北风购买的视频代码 华智经纬CMS 讲师:小伍
一个Java开发的在线考试系统,后台使用 Spring MVC MyBatis FreeMarker 实现。前端使用 Bootstrap jQuery 和 MVVM 框架 Vue.js实现。一个Java开发的在线考试系统,后台使用 Spring MVC MyBatis FreeMarker 实现。...
最新spring3 mvc restful urlrewrite jquery json freemarker整合架构jar图片,欢迎下载: 说明比较少,群号:24172014,不懂来问,已懂讨论
NULL 博文链接:https://elicer.iteye.com/blog/1851718
NULL 博文链接:https://yjmyd1119.iteye.com/blog/1452904
freemarker替换变量实例
Spring MVC是一种基于Java的实现了Web MVC设计模式的请求驱动类型的轻量级Web框架,这篇文章主要介绍了Spring MVC整合 freemarker及使用方法,需要的朋友可以参考下
Spring mvc+hibernate+freemarker(开源项目)