using NVelocity.App;
using NVelocity.Runtime;
using NVelocity;

VelocityEngine vltEngine = new VelocityEngine();
                vltEngine.SetProperty(RuntimeConstants.RESOURCE_LOADER, "file");
                vltEngine.SetProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, System.Web.Hosting.HostingEnvironment.MapPath("~/templates"));
                vltEngine.Init();

VelocityContext vltContext = new VelocityContext();
                vltContext.Put("username", "");
                vltContext.Put("password", "");
                vltContext.Put("msg","");

Template vltTemplate = vltEngine.GetTemplate("login.htm");
                System.IO.StringWriter vltWrite = new System.IO.StringWriter();
                vltTemplate.Merge(vltContext, vltWrite);

string html = vltWrite.GetStringBuilder().ToString();
                context.Response.Write(html);

nvelocity模板引擎的更多相关文章

  1. 【转】NVelocity模板引擎初学总结

    转自:http://sunxitao88.blog.163.com/blog/static/68314439200861963326251/ 前不久,接触到.NET下的MVC-MonoRail,它推荐 ...

  2. NVelocity模板引擎学习笔记

    NVelocity模板引擎学习笔记 学习模板引擎有一段时间现在做一些总结

  3. Nvelocity模板引擎开发网页

    在ASP.NET网站开发中,我们要做许多的网页,如果多个网页的内容框架有些重复使用,我们用NVelocity模板引擎,就可以把相同的部分html代码单独放在一个文件中就行了,当要使用的时候,只需使用# ...

  4. Asp.net动态页面静态化之初始NVelocity模板引擎

    Asp.net动态页面静态化之初始NVelocity模板引擎 静态页面是网页的代码都在页面中,不须要运行asp,php,jsp,.net等程序生成client网页代码的网页,静态页面网址中一般不含&q ...

  5. 初见NVelocity模板引擎

    //using NVelocity.App; //using NVelocity; //using NVelocity.Runtime; VelocityEngine vltEngine = new ...

  6. NVelocity模板引擎的使用

    第一种使用方法直接赋值: VelocityEngine vltEngine = new VelocityEngine(); vltEngine.SetProperty(RuntimeConstants ...

  7. C#模板引擎NVelocity实战项目演练

    一.背景需求 很多人在做邮件模板.短信模板的时候,都是使用特殊标识的字符串进行占位,然后在后台代码中进行Replace字符串,如果遇到表格形式的内容,则需要在后台进行遍历数据集合,进行字符串的拼接,继 ...

  8. 模板引擎Nvelocity实例

    前言 最近一直忙于工作,没时间来管理博客,同时电脑也不给力,坏了一阵又一阵,最后还是去给修理了,这不刚一回来迫不及待的就写一篇文章来满足两个月未写博客的紧迫感. Nvelocity 关于nveloci ...

  9. ASP.NET 模板引擎 - NVelocity

    1,HTML的Form表单数据按Button提交数据以后,由 Action 指定的服务器端处理程序(.ashx)进行处理后 ,再响应的浏览器. 2,我们把 HTML的表单,写到 .ashx 一般处理程 ...

随机推荐

  1. JSBinding + SharpKit / 使用 Firefox 调试 JS

    已经准备好,google打不开,等打开了再贴图上来

  2. 不要告诉我你懂margin

    分类: Html/CSS | 转载请注明: 出自 海玉的博客 本文地址: http://www.hicss.net/do-not-tell-me-you-understand-margin/ 你真的了 ...

  3. ECLIPSE中添加TPTP插件

    转自:http://blog.csdn.net/sinboy/article/details/1536625 程序在实际应用当中,大数据量时对系统本身的影响是一个不得不面对的问题. 最早在使用Jbui ...

  4. share point 2013 显示详细错误信息?

    Wednesday, April 6, 2011 at 17:40 |  Post a Comment SharePoint "Unknown Error": How to Sho ...

  5. nedb nodejs 数据库学习

      // Type 1: In-memory only datastore (no need to load the database) var Datastore = require('nedb') ...

  6. linux node&& npm 安装方式

    1.  编译好的文件 简单说就是解压后,在bin文件夹中已经存在node以及npm,如果你进入到对应文件的中执行命令行一点问题都没有,不过不是全局的,所以将这个设置为全局就好了. cd node-v0 ...

  7. Ueditor 标签被过滤

    1:将allowDivTransToP设置为false 2:将root.traversal方法中的switch注释

  8. php download断点

    FileDownload.class.php <?php /** php下载类,支持断点续传 *   Date:   2013-06-30 *   Author: fdipzone *   Ve ...

  9. linux下为php安装APC扩展

    wget http://pecl.php.net/get/APC-3.1.9.tgztar xzvf APC-3.1.9.tgzcd APC-3.1.9/usr/local/php/bin/phpiz ...

  10. mysql 修改字符集

    查看mysql数据编码 登录MySQL服务,查看mysql数据库默认的编码 mysql> show variables like 'character%'; +----------------- ...