使用Velocity基本步骤

来源:互联网 发布:园林景观软件 编辑:程序博客网 时间:2024/05/01 09:32

使用Velocity基本步骤

 

1 initialize an engine

2 create a context and put data into it

3 choose a template and merge it

 

Velocity.init(properties)

 

VelocityContext context = new VelocityContext();

context.put("key1", "value1");

context.put("key2", "value2");

 

Template t = Velocity.getTemplate(templateFile);

t.merge(context, writer);

 

原创粉丝点击