1.下载最新版的Nvelocity的dll文件并且引用
2.新建一个类,用来调用Nvelocity:
3.初始化模板的设置
这里我调用模板文件并且是utf-8格式的。----如果有乱码的现象可以用gb2312代替;
4.添加一个赋值方法,将数据绑定到模板
5.一个种为显示在页面上。
另一种为生产静态页面
6.然后就可以在页面直接调用了。
WebUpdate.VTemplate helper = new WebUpdate.VTemplate();
/*WebUpdate.VTemplate helper = new WebUpdate.VTemplate(@"template");//模板存放在根目录的template下*/
//helper.Put("Text", "Helooo!");
//helper.Display("template.html");
helper.GetFile("def.html", "Default.html");
这2种方法可以直接用。OK