NVelocity模版引擎

2021-12-29 22:53:20 字數 1365 閱讀 3778

需要引用外部的nvelocity.dll檔案

///

///person類 的摘要說明

//三。合併模版引擎要載入的模版檔案與velocitycontext物件,合併完成後模版引擎內部就會對模版與資料進行整合,並生成新的內容

using(stringwriter strwriter=new stringwriter ())

}public bool isreusable

}}頁面名字是htmlpage.htm

};//2設定資料

vcontext.put("plist", list);

//3合併模版檔案與velocitycontext上下文物件

using (stringwriter strwriter = new stringwriter())

}public bool isreusable }}

頁面的**裡不能有注釋,這裡是為了理解

#foreach($p in $plist) #even #odd #each #end

姓名性別

年齡郵箱

$p.name

$p.age

$p.email

$p.gender

$p.name

$p.age

$p.email

$p.gender

NVelocity模板引擎

因此決定自學一下nvelocity的使用 拋開monorail 安裝後,在其下的bin目錄中可找到nvelocity.dll net專案中將用到 並將其複製出來放到我的測試web bin目錄下。到castleproject上看了一下using it大致有四步 先要引入以下命名空間 using com...

NVelocity模板引擎

簡介 nvelocity是乙個基於.net的模板引擎 template engine 它允許任何人僅僅簡單的使用模板語言 template language 來引用由.net 定義的物件。語法 include head.htm 引入檔案 parse head.htm 引入檔案,與include不同的...

NVelocity 模板引擎筆記

模板引擎載入 velocityengine vltengine new velocityengine vltengine.setproperty runtimeconstants.resource loader,file vltengine.init velocitycontext vltconte...