using NVelocity;
using NVelocity.App;
using NVelocity.Runtime;
VelocityEngine vltEngine = new VelocityEngine();
vltEngine.SetProperty(RuntimeConstants.RESOURCE_LOADER, "file"); //Error 1 'NVelocity.Runtime.RuntimeConstants' does not contain a definition for 'RESOURCE_LOADER'
vltEngine.SetProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, Server.MapPath("~/Template/")); //Error 2 'NVelocity.Runtime.RuntimeConstants' does not contain a definition for 'FILE_RESOURCE_LOADER_PATH'
vltEngine.Init();
VelocityContext vltContext = new VelocityContext();
vltContext.Put("PageTitle", "文件模板例子");
vltContext.Put("ListUsers", listUsers);
Template vltTemplate = vltEngine.GetTemplate("Default.htm");
System.IO.StringWriter vltWriter = new System.IO.StringWriter(); //这里报错Error 3 No overload for method 'StreamWriter' takes '0' arguments
vltTemplate.Merge(vltContext, vltWriter);
Response.Write(vltWriter.GetStringBuilder().ToString());