NVelocity標籤使用詳解

2022-01-19 04:57:21 字數 1553 閱讀 1507

本文目錄:

二、使用

三、**演示。
二、使用步驟。a) 建立velocity 引擎(velocityengine)並設定屬性.

b) velocitycontext 上下文物件建立於設定.

c) 使用velocityengine(velocity 引擎)建立模板(template).

d) 合併模板和上下文物件、輸出.

三、**演示。

先引入nvelocity.dll,然後新增**。

1.一般處理類showhtml.ashx**如下:

@ webhandler language="

c#"class="

showhtml

"%>

using

system;

using

system.web;

//nvelocity 引用

//3.建立模板(template)

template template

=velocityengine.gettemplate(

"default.html");

//4.合併模板和上下文物件、輸出

}}

2.default.html模板**如下:

<

html

xmlns

="">

<

head

>

<

title

>

nvelocity 使用測試模板

title

>

head

>

<

body

>

俺叫$name

<

br />

#foreach($item in $list)

$item

<

br />

#end

body

>

html

>

3.效果如下:

NVelocity標籤使用詳解

使用步驟。a 建立velocity 引擎 velocityengine 並設定屬性.b velocitycontext 上下文物件建立於設定.c 使用velocityengine velocity 引擎 建立模板 template d 合併模板和上下文物件 輸出.演示。先引入nvelocity.dl...

NVelocity標籤使用詳解

本文目錄 二 使用 三 演示。二 使用步驟。a 建立velocity 引擎 velocityengine 並設定屬性.b velocitycontext 上下文物件建立於設定.c 使用velocityengine velocity 引擎 建立模板 template d 合併模板和上下文物件 輸出.三...

使用NVelocity 翻譯

原文參見 有的地方並不是全文對照翻譯,只是意譯 這是乙個非常基本的nvelocity的使用說明。nvelocity可以把模板和資料動態合併 不光是monorail的web頁面可以使用,其他諸如傳送郵件等也可以使用 為了演示簡單,下面的例子我們使用乙個郵件的模板 第一步 生成velocityengin...