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. 使用 margin 让div块内容居中

    问:有一个div块,其width为300px,如何设置margin让div块居中显示? 答:margin设置为 margin:0 auto,即div块的上下外边距设置为 0 , 左右外边距设置为 自动 ...

  2. FrameBuffer

    http://blog.csdn.net/luxiaoxun/article/details/7622988 http://blog.csdn.net/godspirits/article/detai ...

  3. Xilium.CefGlue怎么使用Js调用C#方法

    第1篇:.NET多种WebKit内核/Blink内核浏览器初步测评报告http://www.wuleba.com/?p=23590 第2篇:Xilium CefGlue 关于 CLR Object 与 ...

  4. javascript操作class和style样式

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  5. 彻底解决ASP.NET MVC 3 404错误码返回302的问题

    转自:http://blog.csdn.net/mycloudke/article/details/9746333 404状态码:,意味着当在页面上显示用户点击不存在,提高用户体验度,搜索引擎会放弃这 ...

  6. [转]了解oracle自治事务

    http://blog.csdn.net/indexman/article/details/7799862 1.什么是Oracle自治事务 在官方文档中,是这样的定义的“Autonomous tran ...

  7. 【jmter】逻辑控制器(Logic Controller)

    1. Jmeter官网对逻辑控制器的解释是:“Logic Controllers determine the order in which Samplers are processed.”.意思是说, ...

  8. HackerRank "Vertical Rooks"

    Please note: VROOK cannot go back-ward - that leads to a simple variation to Game of Nim: just XOR. ...

  9. linux下的php网站放到Windows服务器IIS下导入 .htaccess文件伪静态规则转换 (wordpress)

    需要特别注意的是: 1. .htacdess文件在 wordpress中 是可以生成的 安装 WP Super Cache后,开启该插件>>设置>>高级>>找到并点 ...

  10. 通过FTP自动上传当天的备份数据

    @echo off del f:\ftpcfg.txt echo open 192.168.123.2>f:\ftpcfg.txt echo WMS>>f:\ftpcfg.txt e ...