velocity
来源:互联网 发布:js中给文本框赋值 编辑:程序博客网 时间:2024/05/16 14:56
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
try {
String templateFile = "org/yzj/exmaple.vm";
Velocity.init("org/yzj/velocity.properties");
VelocityContext context = new VelocityContext();
List<String> list = new ArrayList<String>();
list.add("test 1");
list.add("test 2");
list.add("test 3");
context.put("list", list);
Template template = Velocity.getTemplate(templateFile);
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
if(template != null)
template.merge(context, writer);
writer.flush();
writer.close();
}catch (Exception e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
/**
* @param args
*/
public static void main(String[] args) {
try {
String templateFile = "org/yzj/exmaple.vm";
Velocity.init("org/yzj/velocity.properties");
VelocityContext context = new VelocityContext();
List<String> list = new ArrayList<String>();
list.add("test 1");
list.add("test 2");
list.add("test 3");
context.put("list", list);
Template template = Velocity.getTemplate(templateFile);
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
if(template != null)
template.merge(context, writer);
writer.flush();
writer.close();
}catch (Exception e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
}
0 0
- Velocity
- Velocity
- Velocity
- Velocity
- Velocity
- Velocity
- velocity
- VELOCITY
- Velocity
- Velocity
- VELOCITY
- velocity
- Velocity
- VELOCITY
- Velocity
- Velocity
- Velocity
- Velocity
- C++构建队列
- 传智播客学习有感
- 网上流传天龙 Server代码分析笔记 -01
- 代码补全
- BBC 野性中国
- velocity
- 腾讯2014校园招聘笔试题
- Android_ UEventObserver_监听USB插拔
- Codeforces Round #264 (Div. 2)E(裸的树询问)
- 学习资料(持续更新)
- android获取路径
- LeetCode Gas Station
- IOS面试题大全
- [综合面试] 2014校招暑假实习生面经(阿里、百度offer)