读书人

Velocity配备

发布时间: 2013-01-05 15:20:39 作者: rapoo

Velocity配置

Velocity 配置文件的默认路径为:?org/apache/velocity/runtime/defaults/velocity.properties

?

配置方法有三种:

1. 写自己的配置文件 customer.properties ?,通过 Velocity.init(filename)来初始化。

2. 通过java.util.Properties对象,通过 Velocity.init(propertiesObject)来初始化。

3. 通过Velocity.setProperty()函数改变配置。

?

可以配置的内容如下:

?

1. 指令配置?

directive.foreach.counter.name: ?foreach循环中,内置的counter的名字,原为:velocityCountdirective.foreach.counter.initial.value: ??foreach循环中内置的counter的初始值,原为: 1directive.include.output.errormsg.start: #include指令出错的开始注释,原为:“<!-- include error ”directive.include.output.errormsg.end:?#include指令出错的结束注释,原为:“see error log -->”.directive.parse.max.depth: ?#parse指令最大嵌套层数??默认值10?2. 编码配置input.encoding:输入的模板的编码 默认值:ISO-8859-1output.encoding:output stream的默认编码,默认值:ISO-8859-13. 日志配置runtime.log: ?默认?velocity.logruntime.log.logsystem: 需要实现接口org.apache.velocity.runtime.log.LogSystem 没有默认值runtime.log.logsystem.class:?org.apache.velocity.runtime.log.AvalonLogSystem ? org.apache.velocity.runtime.log.SimpleLog4J.logSystem. Loggingruntime.log.error.stacktrace:?是否打印 error级别的信息,默认配置是falseruntime.log.warn.stacktrace:?是否打印 warn级别的信息,默认配置是falseruntime.log.info.stacktrace:是否打印 info级别的信息,默认配置是falseruntime.log.invalid.references: 是否打印无效引用的信息。默认值 true 。4. 资源管理resource.manager.class????资源管理类,需要实现接口:org.apache.velocity.runtime.resource.ResourceManager 。默认值:org.apache.velocity.runtime.resource.ResourceManagerImpl。
读书人网 >编程

热点推荐