`

velocity 配置文件详解

阅读更多

velocity配置文件详解

 

在velocity的发布方包中有一个velocity.properties(位于    org.apache.velocity.runtime.defaults package下,
文件定义了velocity的配置信息org.apache.velocity.runtime.RuntimeConstants中定义了key值)

#模板编码:

input.encoding=ISO-8859-1//模板输入编码
output.encoding=ISO-8859-1 //模板输出编码

#foreach配置

directive.foreach.counter.name= velocityCount //计数器名称
directive.foreach.counter.initial.value = 1 //计数器初始值
directive.foreach.maxloops = -1 //最大循环次数,-1为默认不限制 directive.foreach.iterator.name = velocityHasNex //迭代器名称

#set配置

directive.set.null.allowed = false //是否可设置空值

#include配置

directive.include.output.errormsg.start= <!-- include error : //错误信息提示开始字符串
directive.include.output.errormsg.end = see error log --> //错误信息提示结束字符串

#parse配置

directive.parse.max.depth = 10 //解析深度

#模板加载器配置

resource.loader = file //模板加载器类型,默认为文件,可定义多个

file.resource.loader.description= Velocity File Resource Loader //加载器描述
file.resource.loader.class =Velocity.Runtime.Resource.Loader.FileResourceLoader //加载器类名称
file.resource.loader.path = . //模板路径
file.resource.loader.cache = false //是否启用模板缓存
file.resource.loader.modificationCheckInterval = 2 //检查模板更改时间间隔

宏配置

velocimacro.library//指定宏定义文件的位置

velocimacro.permissions.allow.inline= true //是否可以行内定义
velocimacro.permissions.allow.inline.to.replace.global = false //是否可以用行内定义代替全局定义
velocimacro.permissions.allow.inline.local.scope = false //行内定义是否只用于局部

velocimacro.context.localscope= false //宏上下文是否只用于局部
velocimacro.max.depth = 20 //解析深度

velocimacro.arguments.strict= false //宏参数是否启用严格模式

#资源管理器配置

resource.manager.class= Velocity.Runtime.Resource.ResourceManagerImpl //管理器类名称
resource.manager.cache.class = Velocity.Runtime.Resource.ResourceCacheImpl //缓存器类名称

#解析器池配置

parser.pool.class= Velocity.Runtime.ParserPoolImpl //解析池类名称
parser.pool.size = 40 //初始大小

#evaluate配置

directive.evaluate.context.class= Velocity.VelocityContext //上下问类名称

#可插入introspector配置
runtime.introspector.uberspect = Velocity.Util.Introspection.UberspectImpl //默认introspector类名称

#日志配置

runtime.log  =  velocity.log

用以指定 Velocity 运行时日志文件的路劲和日志文件名,如不是全限定的绝对路径,系统会认为想对于当前目录.

runtime.log.logsystem

这个参数没有默认值,它可指定一个实现了org.apache.velocity.runtime.log.LogSystem.接口的自定义日志处理对象给 Velocity。这就方便将 Velocity 与你己有系统的日志机制统一起来

runtime.log.logsystem.class=  org.apache.velocity.runtime.log.AvalonLogSystem

上面这行,是一个示例来指定一个日志记录器.

runtime.log.error.stacktrace=  false

runtime.log.warn.stacktrace=  false

runtime.log.info.stacktrace=  false

这些是错误消息跟踪的开关.将会生成大量、详细的日志内容输出.

runtime.log.invalid.references=  true

当一个引用无效时,打开日志输出.  在生产系统运行中,这很有效,也是很有用的调试工具.

 

本文出自 “java小沙弥” 博客,请务必保留此出处http://leokongwq.blog.51cto.com/1310215/1401263

分享到:
评论

相关推荐

    Velocity配置文件详解

    Struts课堂笔记.rar--struts2的struts.properties配置文件详解

    velocity配置文件路径 struts.velocity.contexts List of Velocity context names velocity的context列表 struts.velocity.manager.classname org.apache.struts2.views.velocity.VelocityManager ...

    Struts2属性文件详解

    Struts2属性文件详解 struts.configuration 该属性指定加载Struts 2配置文件的配置文件管理器.该属性的默认值是org.apache.Struts2.config.DefaultConfiguration, 这是Struts 2默认的配置文件管理器.如果需要实现...

    java web 开发详解

    与许多表示层技术/框架无缝集成:JSP/JSTL、Tiles、Velocity、FreeMarker、Excel、XSL、PDF 等 便于测试——归功于IoC 缺点: 大量的XML配置文件 太过灵活——没有公共的父控制器 没有内置的Ajax支持 Stripe  优点...

    spring jar 包详解

    (2) spring-beans.jar 这个jar文件是所有应用都要用到的,它包含访问配置文件、创建和管理bean以及进行Inversion of Control / Dependency Injection(IoC/DI)操作相关的所有类。如果应用只需基本的IoC/DI支持,...

    Struts2入门教程(全新完整版)

    3.初识struts2配置文件 4 (1).web.xml文件 4 (2).struts.xml文件 4 (3).struts.properties(参default.properties) 4 (4)struts-default.xml 4 (5)其它配置文件 4 4.让MyEclipse提示xml信息 4 5.如何...

    springboot学习

    chapter2-1-1:配置文件详解:自定义属性、随机数、多环境配置等 chapter2-1-2:2.0 新特性(一):配置绑定全解析 chapter2-2-1:2.0 新特性(二):新增事件ApplicationStartedEvent Web开发 chapter3-1-1:构建一...

    Java Web程序设计教程

    8.3.2hibernate配置文件 177 8.3.3configuration与sessionfactory 178 8.3.4session类 179 8.3.5hibernate中的关联关系 179 8.3.6hibernate映射文件 180 8.3.7hibernate工作原理 182 8.4项目实战——新闻内容...

    spring boot 全面的样例代码

    - chapter2-1-1:[配置文件详解:自定义属性、随机数、多环境配置等](http://blog.didispace.com/springbootproperties/) ### Web开发 - chapter3-1-1:[构建一个较为复杂的RESTful API以及单元测试]...

    Maven权威指南 很精典的学习教程,比ANT更好用

    坐标详解 9.5.2. 多模块项目 9.5.3. 项目继承 9.6. POM最佳实践 9.6.1. 依赖归类 9.6.2. 多模块 vs. 继承 9.6.2.1. 简单项目 9.6.2.2. 多模块企业级项目 9.6.2.3. 原型父项目 10. 构建生命周期 10.1...

    Spring 2.5 jar 所有开发包及完整文档及项目开发实例

    这个jar文件是所有应用都要用到的,它包含访问配置文件、创建和管理bean以及进行Inversion of Control / Dependency Injection(IoC/DI)操作相关的所有类。如果应用只需基本的IoC/DI支持,引入spring-core.jar及...

    Spring 2.0 开发参考手册

    3.3.3. bean属性及构造器参数详解 3.3.4. 使用depends-on 3.3.5. 延迟初始化bean 3.3.6. 自动装配(autowire)协作者 3.3.7. 依赖检查 3.3.8. 方法注入 3.4. bean的作用域 3.4.1. Singleton作用域 3.4.2. ...

    Spring-Reference_zh_CN(Spring中文参考手册)

    配置子报表文件 14.7.4.2. 配置子报表数据源 14.7.5. 配置Exporter的参数 15. 集成其它Web框架 15.1. 简介 15.2. 通用配置 15.3. JavaServer Faces 15.3.1. DelegatingVariableResolver 15.3.2. FacesContextUtils ...

    Spring中文帮助文档

    3.3.2. 依赖配置详解 3.3.3. 使用depends-on 3.3.4. 延迟初始化bean 3.3.5. 自动装配(autowire)协作者 3.3.6. 依赖检查 3.3.7. 方法注入 3.4. Bean的作用域 3.4.1. Singleton作用域 3.4.2. Prototype作用...

    Spring API

    3.3.2. 依赖配置详解 3.3.3. 使用depends-on 3.3.4. 延迟初始化bean 3.3.5. 自动装配(autowire)协作者 3.3.6. 依赖检查 3.3.7. 方法注入 3.4. Bean的作用域 3.4.1. Singleton作用域 3.4.2. Prototype作用...

    spring chm文档

    3.3.3. bean属性及构造器参数详解 3.3.4. 使用depends-on 3.3.5. 延迟初始化bean 3.3.6. 自动装配(autowire)协作者 3.3.7. 依赖检查 3.3.8. 方法注入 3.4. bean的作用域 3.4.1. Singleton作用域 3.4.2. ...

    struts in Action

    1. 介绍.........................................................................................................18 1.1. 关于本书...........................................................................

    Struts in Action中文版

    1. 介绍.........................................................................................................18 1.1. 关于本书..........................................................................

Global site tag (gtag.js) - Google Analytics