﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-JAVA流通桥-文章分类-Velocity文章</title><link>http://www.blogjava.net/zhuyan/category/21312.html</link><description>JAVA启发者</description><language>zh-cn</language><lastBuildDate>Fri, 06 Apr 2007 00:30:00 GMT</lastBuildDate><pubDate>Fri, 06 Apr 2007 00:30:00 GMT</pubDate><ttl>60</ttl><item><title>VTL指南</title><link>http://www.blogjava.net/zhuyan/articles/108820.html</link><dc:creator>朱岩</dc:creator><author>朱岩</author><pubDate>Thu, 05 Apr 2007 15:50:00 GMT</pubDate><guid>http://www.blogjava.net/zhuyan/articles/108820.html</guid><wfw:comment>http://www.blogjava.net/zhuyan/comments/108820.html</wfw:comment><comments>http://www.blogjava.net/zhuyan/articles/108820.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/zhuyan/comments/commentRss/108820.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhuyan/services/trackbacks/108820.html</trackback:ping><description><![CDATA[<h1><a name=VTL%E6%8C%87%E5%8D%97-%E5%85%B3%E4%BA%8E%E8%AF%A5%E6%8C%87%E5%8D%97AboutthisGuide></a>关于该指南About this Guide</h1>
<p>这是关于Velocity模版语言的指南。要得到更多的信息，请参阅Velocity 用户手册。This guide is the reference for the Velocity Template Language (VTL). For more information, please also refer to the Velocity User Guide.</p>
<h1><a name=VTL%E6%8C%87%E5%8D%97-%E5%8F%82%E8%80%83References></a>参考References</h1>
<h2><a name=VTL%E6%8C%87%E5%8D%97-%E5%8F%98%E9%87%8FVariables></a>变量Variables</h2>
<p>合法的变量规则：Notation:</p>
<p><strong>$</strong> [ <strong>!</strong> ][ <strong>{</strong> ][ <strong>a..z</strong>, <strong>A..Z</strong> ][ <strong>a..z</strong>, <strong>A..Z</strong>, <strong>0..9</strong>, <strong>-</strong>, <strong>_</strong> ][ <strong>}</strong> ]</p>
<p>例子：Examples:</p>
<ul>
    <li>Normal notation（普通的写法，如果mud-Slinger_9 不存在，则会显示mud-Slinger_9 ）: $mud-Slinger_9
    <li>Silent notation（如果mud-Slinger_9 不存在，则不显示任何东西）: $!mud-Slinger_9
    <li>Formal notation（正规的写法，能最正确的区别变量名字）: ${mud-Slinger_9}
    <h2><a name=VTL%E6%8C%87%E5%8D%97-%E5%B1%9E%E6%80%A7Properties></a>属性Properties</h2>
    </li>
</ul>
<p>合法的规则：Notation:</p>
<p><strong>$</strong> [ <strong>{</strong> ][ <strong>a..z</strong>, <strong>A..Z</strong> ][ <strong>a..z</strong>, <strong>A..Z</strong>, <strong>0..9</strong>, <strong>-</strong>, <strong><em></strong>]* <strong>.</strong>[<strong>a..z</strong>, <strong>A..Z</strong> ][ <strong>a..z</strong>, <strong>A-Z</strong>, <strong>0..9</strong>, <strong>-</strong>, <strong></em></strong>]* [ <strong>}</strong> ]</p>
<p>例子 Examples:</p>
<ul>
    <li>Regular Notation: $customer.Address
    <li>Formal Notation: ${purchase.Total}
    <h2><a name=VTL%E6%8C%87%E5%8D%97-%E6%96%B9%E6%B3%95Methods></a>方法Methods</h2>
    </li>
</ul>
<p>合法的规则Notation:</p>
<p><strong>$</strong> [ <strong>{</strong> ][ <strong>a..z</strong>, <strong>A..Z</strong> ][ <strong>a..z</strong>, <strong>A..Z</strong>, <strong>0..9</strong>, <strong>-</strong>, <strong><em></strong>]* <strong>.</strong>[ <strong>a..z</strong>, <strong>A..Z</strong> ][ <strong>a..z</strong>, <strong>A..Z</strong>, <strong>0..9</strong>, <strong>-</strong>, <strong></em></strong>]*<strong>(</strong> [ <em>opional parameter list...</em> ] <strong>)</strong> [ <strong>}</strong> ]</p>
<p>例子：Examples:</p>
<ul>
    <li>Regular Notation: $customer.getAddress()
    <li>Formal Notation: ${purchase.getTotal()}
    <li>Regular Notation with Parameter List（带有参数的方法的正规调用方式）: $page.setTitle( "My Home Page" )<br>VTL属性调用（get和set方法）可以被简写。比如_$object.getMethod()和$object.setMethod()_ 方法都可以简写成_$object.Method_。在使用的时候，我们更偏好使用后者,即简化的写法。使用调用方法这种写法的最大的好处就在于你能向其中传递一些参数。VTL Properties can be used as a shorthand notation for VTL Methods that take <em>get</em> and <em>set</em>. Either <em>$object.getMethod()</em> or <em>$object.setMethod()</em> can be abbreviated as <em>$object.Method</em>. It is generally preferable to use a Property when available. The main difference between Properties and Methods is that you can specify a parameter list to a Method.
    <h1><a name=VTL%E6%8C%87%E5%8D%97-%E8%AF%AD%E5%8F%A5Directives></a>语句Directives</h1>
    </li>
</ul>
<h2><a name=VTL%E6%8C%87%E5%8D%97-%5C%23set%E7%BB%99%E4%B8%80%E4%B8%AA%E5%BC%95%E7%94%A8%E8%B5%8B%E5%80%BCEstablishesthevalueofareference></a>#set - 给一个引用赋值Establishes the value of a reference</h2>
<p>格式：Format:</p>
<p><strong>#set( $*ref *=</strong> [ <strong>"</strong>, <strong>'</strong> ]arg[ <strong>"</strong>, <strong>'</strong> ] )</p>
<p>其中：Usage:</p>
<ul>
    <li><em>$ref</em> - 左操作数应该是一个变量的引用或者一个属性的引用。The LHS of the assignment must be a variable reference or a property reference.
    <li><em>arg</em> - 右操作，如果右操作数是被双引号括起来的话，那么在赋值给左操作数的时候，返回的是右操作数解析出来的值，如果右操作数是被单引号括起来的话，那么就直接赋值给左操作数。如果右操作数的解析的结果为null的话，不会给左操作数赋值。The RHS of the assignment, <em>arg</em> is parsed if enclosed in double quotes, and not parsed if enclosed in single quotes. If the RHS evaluates to <em>null</em> , it is <strong>not</strong> assigned to the LHS. </li>
</ul>
<p>例子：Examples:</p>
<ul>
    <li>变量的引用：Variable reference: #set( $monkey = "bill" )
    <li>给属性赋值：String literal: #set( $monkey.Friend = "monica" )
    <li>属性赋值：Property reference: #set( $monkey.Blame = $whitehouse.Leak )
    <li>方法引用：Method reference: #set( $monkey.Plan = $spindoctor.weave($web) )
    <li>Number literal: #set( $monkey.Number = 123 )
    <li>Range operator: #set( $monkey.Numbers = [1..3] )
    <li>Object array: #set( $monkey.Say = ["Not", $my, "fault"] ) </li>
</ul>
<p>右操作数也可以是简单的数学表达式，比如：The RHS can also be a simple arithmetic expression, such as:</p>
<ul>
    <li>Addition: #set( $value = $foo + 1 )
    <li>Subtraction: #set( $value = $bar - 1 )
    <li>Multiplication: #set( $value = $foo * $bar )
    <li>Division: #set( $value = $foo / $bar )
    <li>Remainder: #set( $value = $foo % $bar )
    <h2><a name=VTL%E6%8C%87%E5%8D%97-%5C%23if%2F%23elseif%2F%23elseoutputconditionalontruthofstatements%E6%9D%A1%E4%BB%B6%E6%8E%A7%E5%88%B6%E8%AF%AD%E5%8F%A5></a>#if / #elseif / #else - output conditional on truth of statements条件控制语句</h2>
    </li>
</ul>
<p>格式：Format:</p>
<p><strong>#if(</strong> [condition] <strong>)</strong> [output] [ <strong>#elseif(</strong> [condition] <strong>)</strong> [output] ]* [ <strong>#else</strong> [output] ] <strong>#end</strong></p>
<p>其中：Usage:</p>
<ul>
    <li><em>condition</em> - 如果是一个boolean的话，则根据值是true或者false来判断，如果不是一个boolean，则条件的值不为null则为true。If a boolean, considered true if it has a true false; if not a boolean, considered true if not null.
    <li><em>output</em> - May contain VTL. </li>
</ul>
<p>例子：Examples:</p>
<ul>
    <li>相等操作Equivalent Operator: #if( $foo == $bar )
    <li>大于Greater Than: #if( $foo &gt; 42 )
    <li>小于Less Than: #if( $foo &lt; 42 )
    <li>不小于Greater Than or Equal To: #if( $foo &gt;= 42 )
    <li>不大于Less Than or Equal To: #if( $foo &lt;= 42 )
    <li>相等的值Equals Number: #if( $foo == 42 )
    <li>相等的字符串Equals String: #if( $foo == "bar" )
    <li>求反Boolean NOT: #if( !$foo )
    <h2><a name=VTL%E6%8C%87%E5%8D%97-%5C%23foreachLoopsthroughalistofobjects%E9%81%8D%E5%8E%86%E4%B8%80%E4%B8%AA%E5%88%97%E8%A1%A8></a>#foreach - Loops through a list of objects遍历一个列表</h2>
    </li>
</ul>
<p>格式：Format:</p>
<p><strong>#foreach(</strong> <em>$ref</em> <strong>in</strong> <em>arg</em> <strong>)</strong> <em>statement</em> <strong>#end</strong></p>
<p>其中：Usage:</p>
<ul>
    <li><em>$ref</em> - 遍历列表的当前引用。The first variable reference is the item.
    <li><em>arg</em> - 一个列表(比如一个对象数组，集合，map)，或者数组列表，或者范围操作。May be one of the following: a reference to a list (i.e. object array, collection, or map), an array list, or the range operator.
    <li><em>语句statement</em> - 对每次通过遍历得到的一个值得操作。What is output each time Velocity finds a valid item in the list denoted above as <em>arg</em> . This output is any valid VTL and is rendered each iteration of the loop. </li>
</ul>
<p>下面是省略了处理语句的#foreach()的例子：Examples of the #foreach(), omitting the statement block :</p>
<ul>
    <li>引用：Reference: #foreach ( $item in $items )
    <li>数组：Array list: #foreach ( $item in ["Not", $my, "fault"] )
    <li>范围：Range operator: #foreach ( $item in [1..3] ) </li>
</ul>
<p>Velocity提供了一个简单的得到循环次数的方法，所以你可以像下面这样操作：Velocity provides an easy way to get the loop counter so that you can do something like the following:</p>
<p>&lt;table&gt;<br>&nbsp;#foreach( $customer in $customerList )</p>
<p>&lt;tr&gt;</p>
<p>&lt;td&gt;$velocityCount&lt;/td&gt;</p>
<p>&lt;td&gt;$customer.Name&lt;/td&gt;</p>
<p>&lt;/tr&gt;</p>
<p>#end</p>
<p>&lt;/table&gt;<br>默认的计数的变量是$velocityCount，不过，你也能在velocity.properties文件中进行自己的配置。默认的情况下，计数器是从1开始的，但是这也可以在velocity.properties文件中进行配置，也能从0开始计数。下面是在velocity.properties文件中对计数器的名字和起始值配置的代码片断：The default name for the loop counter variable reference, which is specified in the velocity.properties file, is $velocityCount. By default the counter starts at 1, but this can be set to either 0 or 1 in the velocity.properties file. Here's what the loop counter properties section of the velocity.properties file appears:</p>
<p># Default name of the loop counter<br># variable refernce.</p>
<p>counter.name = velocityCount</p>
<p># Default starting value of the loop</p>
<p># counter variable reference.</p>
<p>counter.initial.value = 1</p>
<h2><a name=VTL%E6%8C%87%E5%8D%97-%5C%23include%5C%E4%B8%8D%E5%8A%A0%E8%A7%A3%E9%87%8A%E7%9A%84%E5%90%88%E6%88%90%E6%9C%AC%E5%9C%B0%E6%96%87%E4%BB%B6Renderslocalfile%28s%29thatarenotparsedbyVelocity></a>#include -不加解释的合成本地文件Renders local file(s) that are not parsed by Velocity</h2>
<p>格式：Format:</p>
<p><strong>#include(</strong> arg[, arg2, ... argn] <strong>)</strong></p>
<ul>
    <li><em>arg</em> - Refers to a valid file under TEMPLATE_ROOT. </li>
</ul>
<p>例子：Examples:</p>
<ul>
    <li>String: #include( "disclaimer.txt", "opinion.txt" )
    <li>Variable: #include( $foo, $bar ) </li>
</ul>
<p>什么叫不加解释?就是说velocity只是把这个文件的内容直接合成到指定的位置，而如果在这个文件中也有VTL的语句，是不会翻译的。如果要实现这个功能，要用到下面的#parse。</p>
<h2><a name=VTL%E6%8C%87%E5%8D%97-%5C%23parse%E8%A7%A3%E9%87%8A%E7%9A%84%E5%90%88%E6%88%90%E6%9C%AC%E5%9C%B0%E6%A8%A1%E7%89%88RendersalocaltemplatethatisparsedbyVelocity></a>#parse - 解释的合成本地模版Renders a local template that is parsed by Velocity</h2>
<p>格式：Format:</p>
<p><strong>#parse(</strong> arg <strong>)</strong></p>
<ul>
    <li><em>arg</em> - Refers to a template under TEMPLATE_ROOT. </li>
</ul>
<p>例子：Examples:</p>
<ul>
    <li>String: #parse( "lecorbusier.vm" )
    <li>Variable: #parse( $foo ) </li>
</ul>
<p>这里允许递归的调用。你可以在velocity.properties中改变<em>parse_directive.maxdepth</em> 的值来确定允许递归的层数。（默认的值为10）Recursion permitted. See <em>parse_directive.maxdepth</em> in velocity.properties to change from parse depth. (The default parse depth is 10.)</p>
<h2><a name=VTL%E6%8C%87%E5%8D%97-%5C%23stop%E5%81%9C%E6%AD%A2%E6%A8%A1%E7%89%88%E5%BC%95%E6%93%8EStopsthetemplateengine></a>#stop - 停止模版引擎Stops the template engine</h2>
<p>格式：Format:</p>
<p><strong>#stop</strong></p>
<p>Usage:</p>
<p>这个方法能停止执行当前的模版，很适合用于DEBUG。This will stop execution of the current template. This is good for debugging a template.</p>
<h2><a name=VTL%E6%8C%87%E5%8D%97-%5C%23macro%E5%85%81%E8%AE%B8%E7%94%A8%E6%88%B7%E5%AE%9A%E4%B9%89%E4%B8%80%E4%B8%AAVelocity%E5%AE%8F%EF%BC%88VM%EF%BC%89%EF%BC%8C%E8%83%BD%E9%87%8D%E7%94%A8%E4%B8%80%E4%BA%9B%E6%93%8D%E4%BD%9C%E3%80%82AllowsuserstodefineaVelocimacro%28VM%29%2CarepeatedsegmentofaVTLtemplate%2Casrequired></a>#macro - 允许用户定义一个Velocity宏（VM），能重用一些操作。Allows users to define a Velocimacro (VM), a repeated segment of a VTL template, as required</h2>
<p>格式：Format:</p>
<p><strong>#macro(</strong> vmname $arg1 [ $arg2 $arg3 ... $argn ] <strong>)</strong> [ VM VTL code... ] <strong>#end</strong></p>
<ul>
    <li><em>vmname</em> - 宏的名字。Name used to call the VM ( <em>#vmname</em> )
    <li><em>$arg1 $arg2 [ ... ]</em> - 传递给VM的参数列表。参数的个数不限，但调用时候传入的参数必须和定义宏的时候规定的参数个数相同。Arguments to the VM. There can be any number of arguments, but the number used at invocation must match the number specified in the definition.
    <li><em>[ VM VTL code... ]</em> - 合法的VTL代码。任何能放在模版中的代码都能放在VM里面。Any valid VTL code, anything you can put into a template, can be put into a VM. </li>
</ul>
<p>如果宏一旦定义，就可以像下面这样调用：Once defined, the VM is used like any other VTL directive in a template.</p>
<p>#vmname( $arg1 $arg2 )<br>VM可以在下面两个地方定义：VMs can be defined in one of two places:</p>
<ol>
    <li><em>Template library:</em> can be either VMs pre-packaged with Velocity or custom-made, user-defined, site-specific VMs; available from any template
    <li><em>Inline:</em> found in regular templates, only usable when <em>velocimacro.permissions.allowInline=true</em> in velocity.properties .
    <h1><a name=VTL%E6%8C%87%E5%8D%97-%E6%B3%A8%E9%87%8AComments></a>注释Comments</h1>
    </li>
</ol>
<p>被注释了的内容不会被合成。Comments are not rendered at runtime.</p>
<h2><a name=VTL%E6%8C%87%E5%8D%97-%E5%8D%95%E8%A1%8C%E7%9A%84%E6%B3%A8%E9%87%8ASingleLine></a>单行的注释Single Line</h2>
<p>Example:</p>
<p><strong>## This is a comment.</strong></p>
<h2><a name=VTL%E6%8C%87%E5%8D%97-%E5%A4%9A%E8%A1%8C%E7%9A%84%E6%B3%A8%E9%87%8AMultiLine></a>多行的注释Multi Line</h2>
<p>Example:</p>
<p><strong>#*</strong><br><strong>This is a multiline comment.</strong><br><strong>This is the second line</strong><br><strong>*#</strong> </p>
<!--
<rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:description
rdf:about="http://wiki.easyjf.com/pages/viewpage.action?pageId=119"
dc:identifier="http://wiki.easyjf.com/pages/viewpage.action?pageId=119"
dc:title="VTL指南"
trackback:ping="http://wiki.easyjf.com/rpc/trackback/119"/>
</rdf:rdf>
--><!--
Root decorator: all decisions about how a page is to be decorated via the
inline decoration begins here.
--><!--
Switch based upon the context. However, for now, just delegate to a decorator
identified directly by the context.
-->
<img src ="http://www.blogjava.net/zhuyan/aggbug/108820.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhuyan/" target="_blank">朱岩</a> 2007-04-05 23:50 <a href="http://www.blogjava.net/zhuyan/articles/108820.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Velocity在Web </title><link>http://www.blogjava.net/zhuyan/articles/108819.html</link><dc:creator>朱岩</dc:creator><author>朱岩</author><pubDate>Thu, 05 Apr 2007 15:49:00 GMT</pubDate><guid>http://www.blogjava.net/zhuyan/articles/108819.html</guid><wfw:comment>http://www.blogjava.net/zhuyan/comments/108819.html</wfw:comment><comments>http://www.blogjava.net/zhuyan/articles/108819.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/zhuyan/comments/commentRss/108819.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhuyan/services/trackbacks/108819.html</trackback:ping><description><![CDATA[<h1><a name=Velocity%E5%9C%A8Web-%E7%94%A8Velocity%E6%9E%84%E5%BB%BA%E4%B8%80%E4%B8%AAWeb%E5%BA%94%E7%94%A8></a>用Velocity构建一个Web应用</h1>
<p>Velocity在应用中通常用于生成页面，来直接代替JSP。一些使用Velocity来生成Web页面的好处如下：Velocity is often used to generate web pages in applications, usually as a direct replacement for JSP. Some of the benefits of using Velocity to generate web pages are:</p>
<ul>
    <li><strong>简单Simplicity</strong> -没有多少技术的Web设计者就能书写这些页面。 The pages can be written and maintained by non-technical web designers.
    <li><strong>容易维护Ease of maintainance</strong> - 使用推荐的MVC开发模式，小程序（script）不再出现在Web页面中。Scripting is removed from web pages with the recommended MVC approach.
    <li><strong>对方法和属性的访问Access both methods and properties</strong> - Web设计者可以访问上下文中一个对象的属性和方法。Web designers can reference methods as well as properties of objects in a context.
    <li><strong>一致性Consistency</strong> -Velocity可以被用作其他的文本生成工作（比如发送email），并提供了一致的标记语言。 Velocity can be used for other text generation tasks (such as sending email) providing a consistent way to mark up text. </li>
</ul>
<p>这篇文档中提供了一些将Velocity用于Web应用中的基本信息。This document provides some basic info on getting started with Velocity in a web application.</p>
<h1><a name=Velocity%E5%9C%A8Web-%E4%BD%BF%E7%94%A8%E4%B8%80%E4%B8%AA%E6%A1%86%E6%9E%B6></a>使用一个框架</h1>
<p>Velocity引擎的主要功能是基于一个模版生成文本。因此，Velocity并没有包含任何与Web相关的功能。The primary purpose of the Velocity engine is simply to generate text based on a template. Consequently, Velocity does not contain any web-related functionality in and of itself. 要创建一个Web应用，你需要一个框架来响应HTTP请求，处理用户认证，调用业务逻辑，并且返回响应。To make a web application, you will need a framework to respond to HTTP requests, handle user authentication, make business logic calls, and generate a response. 下面是一些非常强大的提供者。There are several strong contenders.</p>
<ol>
    <li><strong>Velocity Tools / <a title=VelocityViewServlet href="http://wiki.easyjf.com/display/wiki/VelocityViewServlet"><u><font color=#0000ff>VelocityViewServlet</font></u></a></strong> - 最简单的开始的方法是下载Velocity Tools子项目，使用<a title=VelocityViewServlet href="http://wiki.easyjf.com/display/wiki/VelocityViewServlet"><u><font color=#0000ff>VelocityViewServlet</font></u></a>。这个servlet的配置和安装都很简单。The easiest way to get started is to download the companion Velocity Tools subproject and use the <a title=VelocityViewServlet href="http://wiki.easyjf.com/display/wiki/VelocityViewServlet"><u><font color=#0000ff>VelocityViewServlet</font></u></a> . This servlet is easy to configure and install.你需要在web服务器上创建一个模版的目录，并编辑一个包含了需要放置在上下文中的"Tools"的列表的XML文件就行了。具体的细节请参见下面的指南。 You create a directory of templates on your web server, edit an XML file that lists various "Tools" to place in the context and you are off. More details can be found in the tutorial below.
    <li><strong>Velocity Tools / <span class=nobr><a class=createlink title="Create Page: VelocityStruts" href="http://wiki.easyjf.com/pages/createpage.action?spaceKey=wiki&amp;title=VelocityStruts&amp;linkCreation=true&amp;fromPageId=110"><u><font color=#0000ff>VelocityStruts<sup><img class=rendericon height=7 alt="" src="http://wiki.easyjf.com/images/icons/plus.gif" width=7 align=absMiddle border=0></sup></font></u></a></span></strong> - 也许你对流行的Struts框架比较熟悉。Struts最开始是为了设计一个为JSP提供更多有用的功能的应用。You may be familiar with the popular Struts framework, originally designed to provide much needed application functionality to JSP.在Velocity Tools 的<span class=nobr><a class=createlink title="Create Page: VelocityStruts" href="http://wiki.easyjf.com/pages/createpage.action?spaceKey=wiki&amp;title=VelocityStruts&amp;linkCreation=true&amp;fromPageId=110"><u><font color=#0000ff>VelocityStruts<sup><img class=rendericon height=7 alt="" src="http://wiki.easyjf.com/images/icons/plus.gif" width=7 align=absMiddle border=0></sup></font></u></a></span>模块的帮助下，你可以用Velocity代替JSP作为页面的模版语言。这允许你使用Struts强大的基础设施的好处的同时，使用Velocity设计页面。 With the <span class=nobr><a class=createlink title="Create Page: VelocityStruts" href="http://wiki.easyjf.com/pages/createpage.action?spaceKey=wiki&amp;title=VelocityStruts&amp;linkCreation=true&amp;fromPageId=110"><u><font color=#0000ff>VelocityStruts<sup><img class=rendericon height=7 alt="" src="http://wiki.easyjf.com/images/icons/plus.gif" width=7 align=absMiddle border=0></sup></font></u></a></span> module of Velocity Tools you can substitute Velocity for JSP as the page template language. This allows you to take advantage of the large base of Struts infrastructure while designing pages using Velocity.
    <li><strong>第三方框架Third party frameworks</strong> - 还有许多的第三方框架在<span class=nobr><a class=createlink title="Create Page: PoweredByVelocity" href="http://wiki.easyjf.com/pages/createpage.action?spaceKey=wiki&amp;title=PoweredByVelocity&amp;linkCreation=true&amp;fromPageId=110"><u><font color=#0000ff>PoweredByVelocity<sup><img class=rendericon height=7 alt="" src="http://wiki.easyjf.com/images/icons/plus.gif" width=7 align=absMiddle border=0></sup></font></u></a></span> wiki 页面上。There are a number of third party frameworks listed on the <span class=nobr><a class=createlink title="Create Page: PoweredByVelocity" href="http://wiki.easyjf.com/pages/createpage.action?spaceKey=wiki&amp;title=PoweredByVelocity&amp;linkCreation=true&amp;fromPageId=110"><u><font color=#0000ff>PoweredByVelocity<sup><img class=rendericon height=7 alt="" src="http://wiki.easyjf.com/images/icons/plus.gif" width=7 align=absMiddle border=0></sup></font></u></a></span> wiki page. 在其中，Spring可能是被公认的最先进的框架了。Of these, Spring is probably the most sophisticated and well known. Jakarta Turbine 有许多特点并且也很有用，它基于Velocity并使用Velocity作为主要的页面语言，这并不奇怪，因为有许多Velocity的早期开发者在开发和维护它。Jakarta Turbine has many features and can also be very useful. It was built with Velocity as the primary page language, which is not surprising since many of the original Velocity developers were involved in creating it.一个更简单的选择是Maverick框架，Maverick提供了一个很好的集成了Velocity的简单的控制器结构，但仅此而已。 A simpler alternative is the Maverick framework which provides a simple Controller architecture that integrates nicely with Velocity but has no bells or whistles.
    <li><strong>构建你自己的Build your own</strong> - 最后的一个选择是创建你自己的框架。A final alternative is to build your own framework.建立一个转发servlet（Dispatcher servlet），从一个文件或者数据库中检索出模版，集成你自己的商务逻辑，并返回结果给用户。 Create a dispatcher servlet, retrieve templates from a file or database, integate with your business logic and send the results back to the user. 从一个已有的框架出发并扩展它通常是一更简单的方法。特别的，你只需要为<a title=VelocityViewServlet href="http://wiki.easyjf.com/display/wiki/VelocityViewServlet"><u><font color=#0000ff>VelocityViewServlet</font></u></a>创建一个子类，既能向其中添加新的功能。Often you'll have an easier time starting with one of the existing frameworks and customizing it. In particular you can add new functionality to the <a title=VelocityViewServlet href="http://wiki.easyjf.com/display/wiki/VelocityViewServlet"><u><font color=#0000ff>VelocityViewServlet</font></u></a> simply by creating a subclass. </li>
</ol>
<p>顺便一提，你可能偶然发现<span class=nobr><a class=createlink title="Create Page: VelocityServlet" href="http://wiki.easyjf.com/pages/createpage.action?spaceKey=wiki&amp;title=VelocityServlet&amp;linkCreation=true&amp;fromPageId=110"><u><font color=#0000ff>VelocityServlet<sup><img class=rendericon height=7 alt="" src="http://wiki.easyjf.com/images/icons/plus.gif" width=7 align=absMiddle border=0></sup></font></u></a></span>这个类，该对象是一个在Velocity 1.4版本中不提倡使用的servlet。<span class=nobr><a class=createlink title="Create Page: VelocityServlet" href="http://wiki.easyjf.com/pages/createpage.action?spaceKey=wiki&amp;title=VelocityServlet&amp;linkCreation=true&amp;fromPageId=110"><u><font color=#0000ff>VelocityServlet<sup><img class=rendericon height=7 alt="" src="http://wiki.easyjf.com/images/icons/plus.gif" width=7 align=absMiddle border=0></sup></font></u></a></span>已经不再维护，所以，我们强烈建议你使用Velocity Tools中的<a title=VelocityViewServlet href="http://wiki.easyjf.com/display/wiki/VelocityViewServlet"><u><font color=#0000ff>VelocityViewServlet</font></u></a>。As a side note, you may also come across references to <span class=nobr><a class=createlink title="Create Page: VelocityServlet" href="http://wiki.easyjf.com/pages/createpage.action?spaceKey=wiki&amp;title=VelocityServlet&amp;linkCreation=true&amp;fromPageId=110"><u><font color=#0000ff>VelocityServlet<sup><img class=rendericon height=7 alt="" src="http://wiki.easyjf.com/images/icons/plus.gif" width=7 align=absMiddle border=0></sup></font></u></a></span>, which is a deprecated servlet that was included in the Velocity Engine up to version 1.4. Since <span class=nobr><a class=createlink title="Create Page: VelocityServlet" href="http://wiki.easyjf.com/pages/createpage.action?spaceKey=wiki&amp;title=VelocityServlet&amp;linkCreation=true&amp;fromPageId=110"><u><font color=#0000ff>VelocityServlet<sup><img class=rendericon height=7 alt="" src="http://wiki.easyjf.com/images/icons/plus.gif" width=7 align=absMiddle border=0></sup></font></u></a></span> is no longer being maintained we strongly recommend you use <a title=VelocityViewServlet href="http://wiki.easyjf.com/display/wiki/VelocityViewServlet"><u><font color=#0000ff>VelocityViewServlet</font></u></a> in Velocity Tools instead.</p>
<h1><a name=Velocity%E5%9C%A8Web-Web%E6%96%B9%E9%9D%A2%E7%9A%84%E9%97%AE%E9%A2%98WebSpecificIssues></a>Web方面的问题Web-Specific Issues</h1>
<p>对于Velocity在web的应用，有一些问题需要讨论。这些都是经常遇到的问题中的一些简单的讨论。There are a few issues with Velocity that are specific to web applications. Here is a brief discussion of the most commonly encountered issues.</p>
<h2><a name=Velocity%E5%9C%A8Web-%E4%B8%8D%E8%A6%81%E6%94%B9%E5%8F%98%E5%AF%B9%E8%B1%A1%E7%9A%84%E7%8A%B6%E6%80%81ChangingObjectStateDon%27t%5C%21></a>不要改变对象的状态Changing Object State - Don't!</h2>
<p>在Velocity中，如果将一个对象作为一个引用，那么Velocity提供了访问该对象的任何方法的能力。在页面中显示信息的时候，这个功能很有用，但是同时如果对象或者应用的状态被改变了，这样做也是很危险的。Velocity provides the ability to call any method of an object acting as a reference. This can be useful when displaying information into the page but is dangerous when object or application state is modified.</p>
<p>举个例子，下面的代码安全的调用了一个list的size()方法并显示结果。For example, the following code safely calls the size() method of a list and displays the result.</p>
<p>There are $users.size() currently logged in.<br>一个不安全调用的例子：在一个财务web页面上，在上下文中的一个对象能计算每一年的数据。方法calculateNextYear()方法能计算下一年的数据并将一个内部的计数器做增加操作。An example of an unsafe operation concerns a financial web page with an object in the context that calculates data year by year. The method calculateNextYear() calculates data for the next year and advances an internal counter:</p>
<p>2005 data: $table.data<br>$table.calculateNextYear()</p>
<p>2006 data: $table.data<br>The problem with this approach is that the code cannot be repeated in multiple parts of the page. You may not intend to do so, but it's easy to forget this when cutting and pasting or writing control statements (such as #if or #foreach). This becomes more of an issue when you are dealing with application or session-level state.</p>
<p>我们强烈建议的实践是只使用Velocity向文本中插入信息。方法调用会是得到信息的一个有效的方法，但一般说来使用一个方法调用来改变对象的状态是一个不良的观念，来改变应用的状态一定是一个错误的想法。The (strongly) recommended practice is to only use Velocity for inserting information into text. Method calls can be useful to retrieve information. However, it's generally a bad idea to use a method call to change object state, and it's always a bad idea to change application state.</p>
<p>如果你必需要改变对象的状态（比如前面的例子），可以预先计算出所有可能的值并放入一个List或则Map对象中。所有的要改变应用的状态的动作应该总是放在控制器中。If you find yourself needing to change object state (as in the previous example) try precalculating all the possible values in the controller and putting them in a List or Map. Any changes to application state should always be done by the controller.</p>
<p>一个相关的注意，你应该在上下文对象中放入一个List或者一个Set对象，而不是放入一个Iterator或者Enumeration。这样允许集合对象在没有改变时重复使用。On a related note, you should always put a List or Set into the context instead of an Iterator or Enumeration. This allows the collection to be used more than once in the page with no change in behavior.</p>
<h2><a name=Velocity%E5%9C%A8Web-%E5%8E%BB%E6%8E%89HTML%2FXML%E6%A0%87%E8%AE%B0EscapingHTML%2FXMLEntities></a>去掉HTML/XML标记Escaping HTML/XML Entities</h2>
<p>任何用户添加的带有HTML或者XML标记（比如&lt;,&gt;,&amp;）的文本都应该在填到web页面之前被去掉。为了确保页面正确显示和避免危险的跨站点脚本（cross-site scripting一种攻击手段，在页面中包含另一个带有木马的页面）。不象JSTL（Java标准标记语言），Velocity不包含去除HTML标记的功能，但是你可以通过三种方法来达到目的。Any user-entered text that contains special HTML or XML entities (such as &lt;, &gt;, or &amp;) needs to be escaped before included in the web page. This is required, both to ensure the text is visible, and also to prevent dangerous cross-site scripting. Unlike, for example, JSTL (the Java Standard Tag Language found in Java Server Pages), Velocity does not contain any HTML-specific escaping functionality. However, you have three options:</p>
<ol>
    <li>创建一个"Tool"，并且包含一个能去掉HTML标记的方法。比如 $escape.html($usertext)。这是最简单的解决问题的方法。Create a special "Tool" (an object in the context) with a method that performs escaping, for example $escape.html($usertext). This is conceptually the easiest way to solve this problem.
    <li>创建一个自定义的<span class=nobr><a class=createlink title="Create Page: ReferenceInsertionEventHandler" href="http://wiki.easyjf.com/pages/createpage.action?spaceKey=wiki&amp;title=ReferenceInsertionEventHandler&amp;linkCreation=true&amp;fromPageId=110"><u><font color=#0000ff>ReferenceInsertionEventHandler<sup><img class=rendericon height=7 alt="" src="http://wiki.easyjf.com/images/icons/plus.gif" width=7 align=absMiddle border=0></sup></font></u></a></span> ，能自动的去掉所有引用中的HTML标签。如果所有的引用中的内容都需要被检查并去掉HTML标签，那么这样做是最省事的。Create a custom <span class=nobr><a class=createlink title="Create Page: ReferenceInsertionEventHandler" href="http://wiki.easyjf.com/pages/createpage.action?spaceKey=wiki&amp;title=ReferenceInsertionEventHandler&amp;linkCreation=true&amp;fromPageId=110"><u><font color=#0000ff>ReferenceInsertionEventHandler<sup><img class=rendericon height=7 alt="" src="http://wiki.easyjf.com/images/icons/plus.gif" width=7 align=absMiddle border=0></sup></font></u></a></span> that automatically escapes every reference. If all references need to be escaped, this is the most painless method.
    <li>创建一个自定义的标识，比如#escape，来去掉在该标识对里面的所有引用中的HMTL标签。Create a custom directive (e.g. #escape) that escapes all text within the directive block. </li>
</ol>
<p>注意，有时候其他的标记也需要被去掉。比如在CSS里面，@需要被去掉，在Javascript，单独的'符号需要从字符串中去掉或替换。Note that other kinds of escaping are sometimes required. For example, in style sheets the @ character needs to be escaped, and in Javascript strings the single apostrophe ' needs to be escaped.</p>
<h2><a name=Velocity%E5%9C%A8Web-%E5%BA%94%E7%94%A8%E7%9A%84%E5%AE%89%E5%85%A8SecuringtheApplication></a>应用的安全Securing the Application</h2>
<p>当一个web应用在服务器上开始运行了，有了若干的用户和一些受保护的资源，这时候，应用的安全性方面的要求就显现出来了。Velocity中已经涵盖了大多数标准的web安全性标准。一些特别的问题（比如系统配置，跨站点脚本，或者方法自省）等都在Building Secure Applications with Velocity 这篇文章上有所介绍。Since a web application is running on a central server, that typically has multiple users and confidential resources, care must be taken to make certain that the web application is secure. Most standard web security principles apply to a web application built with Velocity. A few specific issues (such as system configuration, more on cross-site scripting, and method introspection) are written up in this article on Building Secure Applications with Velocity.</p>
<h2><a name=Velocity%E5%9C%A8Web-%E6%97%A5%E5%BF%97%E6%96%87%E4%BB%B6LogFiles></a>日志文件Log Files</h2>
<p>还有一点就是Velocity在日志方面的配置比较缺乏。他总是在当前文件夹中创建一个日志文件。当Velocity用在Web应用中的时候，当前文件夹指的是应用开始的那个文件夹。如果你发现"velocity.log"这个文件出现在你文件系统的不固定位置，请检查你的Velocity 日志的配置。一般情况下，出现这个问题的原因是在除了页面生成之外的其他地方还使用了Velocity（比如发送邮件）。A minor point is that Velocity, in the absence of any log-related configuration, creates a log file in the current directory. When Velocity is used in a web application the "current directory" is usually the current directory from which the application server is started. If you start seeing the file "velocity.log" files in random places on your server filesystem, check the Velocity log configuration. Typically this occurs when Velocity is used within a web application outside of web page generation (e.g. for sending email).</p>
<h1><a name=Velocity%E5%9C%A8Web-%E6%8C%87%E5%8D%97Tutorial></a>指南Tutorial</h1>
<p>下面是一个介绍使用<a title=VelocityViewServlet href="http://wiki.easyjf.com/display/wiki/VelocityViewServlet"><u><font color=#0000ff>VelocityViewServlet</font></u></a>来建立一个简单的web应用的简要教程。更多的信息请参见Velocity Tools 的文档。What follows is a brief tutorial on building a simple web app with <a title=VelocityViewServlet href="http://wiki.easyjf.com/display/wiki/VelocityViewServlet"><u><font color=#0000ff>VelocityViewServlet</font></u></a>. For more information, consult the Velocity Tools documentation.</p>
<ol>
    <li>从 download page 下载Velocity Tools项目的源代码。里面包含了下面介绍的这个例子的代码。Download the Velocity Tools project source (you need the source for the examples) from download page .
    <li>请确保你的 Apache Ant 环境安装正确。If you haven't already installed Apache Ant . do so now.
    <li>使用下面的指令来构建<span class=nobr><a class=createlink title="Create Page: VelocityTools" href="http://wiki.easyjf.com/pages/createpage.action?spaceKey=wiki&amp;title=VelocityTools&amp;linkCreation=true&amp;fromPageId=110"><u><font color=#0000ff>VelocityTools<sup><img class=rendericon height=7 alt="" src="http://wiki.easyjf.com/images/icons/plus.gif" width=7 align=absMiddle border=0></sup></font></u></a></span>的jar包和"simple"示例。Build the Velocity Tools jar and the "simple" example by typing: ant example.simple
    <li>察看"examples"文件夹，在里面你会发现一个叫"index.vm"的文件，下面是这个文件的摘录：Take a look at the "examples" directory. You will see a file "index.vm". Here's an excerpt: &lt;html&gt; &lt;body&gt; I'm a velocity template. <br clear=all>#if( $XHTML ) <br clear=all>#set( $br = "&lt;br /&gt;" ) <br clear=all>#else <br clear=all>#set( $br = "&lt;br&gt;" ) <br clear=all>#end <br clear=all>$br $br <br clear=all>Here we use a custom tool: $toytool.message <br clear=all>$br $br <br clear=all>Here we get the date from the <span class=nobr><a class=createlink title="Create Page: DateTool" href="http://wiki.easyjf.com/pages/createpage.action?spaceKey=wiki&amp;title=DateTool&amp;linkCreation=true&amp;fromPageId=110"><u><font color=#0000ff>DateTool<sup><img class=rendericon height=7 alt="" src="http://wiki.easyjf.com/images/icons/plus.gif" width=7 align=absMiddle border=0></sup></font></u></a></span>: $date.medium <br clear=all>&lt;/body&gt;<br clear=all>&lt;/html&gt;<br>你可以复制其他的velocity模版文件到这个文件夹里面。在examples/WEB-INF文件夹下，你会发现一个"toolbox.xml"文件，在这个文件里面就定义了自动放在Velocity上下文中的对象的列表。You can copy any additional velocity files into this same directory. In examples/WEB-INF you will see a file "toolbox.xml". This specifies a list of "Tools" that are automatically included in the context. &lt;toolbox&gt; &lt;xhtml&gt;true&lt;/xhtml&gt; <br clear=all>&lt;tool&gt; <br clear=all>&lt;key&gt;toytool&lt;/key&gt; <br clear=all>&lt;class&gt;<span class=nobr><a class=createlink title="Create Page: ToyTool" href="http://wiki.easyjf.com/pages/createpage.action?spaceKey=wiki&amp;title=ToyTool&amp;linkCreation=true&amp;fromPageId=110"><u><font color=#0000ff>ToyTool<sup><img class=rendericon height=7 alt="" src="http://wiki.easyjf.com/images/icons/plus.gif" width=7 align=absMiddle border=0></sup></font></u></a></span>&lt;/class&gt; <br clear=all>&lt;/tool&gt; <br clear=all>&lt;data type="number"&gt; <br clear=all>&lt;key&gt;version&lt;/key&gt; &lt;value&gt;1.1&lt;/value&gt; <br clear=all>&lt;/data&gt; <br clear=all>&lt;data type="boolean"&gt; <br clear=all>&lt;key&gt;isSimple&lt;/key&gt; &lt;value&gt;true&lt;/value&gt; <br clear=all>&lt;/data&gt; <br clear=all>&lt;data type="string"&gt;<br clear=all>&lt;key&gt;foo&lt;/key&gt; &lt;value&gt;this is foo.&lt;/value&gt; <br clear=all>&lt;/data&gt; <br clear=all>&lt;data type="string"&gt; <br clear=all>&lt;key&gt;bar&lt;/key&gt; &lt;value&gt;this is bar.&lt;/value&gt; <br clear=all>&lt;/data&gt; <br clear=all>&lt;tool&gt; <br clear=all>&lt;key&gt;map&lt;/key&gt; <br clear=all>&lt;class&gt;java.util.<span class=nobr><a class=createlink title="Create Page: HashMap" href="http://wiki.easyjf.com/pages/createpage.action?spaceKey=wiki&amp;title=HashMap&amp;linkCreation=true&amp;fromPageId=110"><u><font color=#0000ff>HashMap<sup><img class=rendericon height=7 alt="" src="http://wiki.easyjf.com/images/icons/plus.gif" width=7 align=absMiddle border=0></sup></font></u></a></span>&lt;/class&gt; <br clear=all>&lt;/tool&gt; <br clear=all>&lt;tool&gt; <br clear=all>&lt;key&gt;date&lt;/key&gt; <br clear=all>&lt;scope&gt;application&lt;/scope&gt; &lt;class&gt;org.apache.velocity.tools.generic.<span class=nobr><a class=createlink title="Create Page: DateTool" href="http://wiki.easyjf.com/pages/createpage.action?spaceKey=wiki&amp;title=DateTool&amp;linkCreation=true&amp;fromPageId=110"><u><font color=#0000ff>DateTool<sup><img class=rendericon height=7 alt="" src="http://wiki.easyjf.com/images/icons/plus.gif" width=7 align=absMiddle border=0></sup></font></u></a></span>&lt;/class&gt; &lt;/tool&gt; <br clear=all>&lt;/toolbox&gt; &nbsp;<br>最后，应用的web.xml文件里面定义了接受请求的servlet和toolbox的配置文件位置。And finally the web.xml file specifies the name of the servlet and location of toolbox.properties. &lt;web-app&gt; &lt;servlet&gt; <br clear=all>&lt;servlet-name&gt;velocity&lt;/servlet-name&gt; <br clear=all>&lt;servlet-class&gt; org.apache.velocity.tools.view.servlet.<a title=VelocityViewServlet href="http://wiki.easyjf.com/display/wiki/VelocityViewServlet"><u><font color=#0000ff>VelocityViewServlet</font></u></a> &lt;/servlet-class&gt; <br clear=all>&lt;init-param&gt; <br clear=all>&lt;param-name&gt;org.apache.velocity.toolbox&lt;/param-name&gt; <br clear=all>&lt;param-value&gt;/WEB-INF/toolbox.xml&lt;/param-value&gt; &lt;/init-param&gt; <br clear=all>&lt;load-on-startup&gt;10&lt;/load-on-startup&gt; <br clear=all>&lt;/servlet&gt; <br clear=all>&lt;servlet-mapping&gt; <br clear=all>&lt;servlet-name&gt;velocity&lt;/servlet-name&gt; <br clear=all>&lt;url-pattern&gt;*.vm&lt;/url-pattern&gt; <br clear=all>&lt;/servlet-mapping&gt; <br clear=all>&lt;welcome-file-list&gt; <br clear=all>&lt;welcome-file&gt;index.vm&lt;/welcome-file&gt; <br clear=all>&lt;/welcome-file-list&gt; <br clear=all>&lt;/web-app&gt;
    <li>将这个文件夹拷贝到你Tomcat的webapps文件夹下，请拷贝整个文件夹（而不光是simple.war）会让你更容易通过改变或者添加一些东西来做些实验。现在，你可以通过下面的地址来访问页面了。（地址随着你的项目的名字改变）Copy this directory into your "webapps" directory on Tomcat. You could also copy "simple.war", but copying in the entire directory will let you experiment with changes. You should now be able to access your simple one-page webapp with this URL. (or something similar): <span class=nobr><a title="Visit page outside Confluence" href="http://localhost:8080/simple/index.vm" rel=nofollow><u><font color=#0000ff>http://localhost:8080/simple/index.vm<sup><img class=rendericon height=7 alt="" src="http://wiki.easyjf.com/images/icons/linkext7.gif" width=7 align=absMiddle border=0></sup></font></u></a></span>
    <li>尝试添加一些新的Velocity页面。注意，你只需要改变访问的URL地址就可以访问新的页面了。尝试改变toolbox.xml中的一些内容，或者向其中添加你自己的Tools。察看examples/WEB-INF的文档，或者Wiki 来得到更多的工具的使用信息。Experiment with adding new Velocity pages. Note that you can access any velocity page just by changing the URL. Try changing the entries in toolbox.xml or creating your own tools. Consult the Velocity Tools documentation and the Wiki for more info on the wide variety of tools available. </li>
</ol>
<!--
<rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:description
rdf:about="http://wiki.easyjf.com/pages/viewpage.action?pageId=110"
dc:identifier="http://wiki.easyjf.com/pages/viewpage.action?pageId=110"
dc:title="Velocity在Web"
trackback:ping="http://wiki.easyjf.com/rpc/trackback/110"/>
</rdf:rdf>
--><!--
Root decorator: all decisions about how a page is to be decorated via the
inline decoration begins here.
--><!--
Switch based upon the context. However, for now, just delegate to a decorator
identified directly by the context.
-->
<img src ="http://www.blogjava.net/zhuyan/aggbug/108819.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhuyan/" target="_blank">朱岩</a> 2007-04-05 23:49 <a href="http://www.blogjava.net/zhuyan/articles/108819.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Velocity开发者指南</title><link>http://www.blogjava.net/zhuyan/articles/108818.html</link><dc:creator>朱岩</dc:creator><author>朱岩</author><pubDate>Thu, 05 Apr 2007 15:48:00 GMT</pubDate><guid>http://www.blogjava.net/zhuyan/articles/108818.html</guid><wfw:comment>http://www.blogjava.net/zhuyan/comments/108818.html</wfw:comment><comments>http://www.blogjava.net/zhuyan/articles/108818.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/zhuyan/comments/commentRss/108818.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhuyan/services/trackbacks/108818.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 概述和入门Introduction and Getting Started    资源Resources    Velocity怎样工作How Velocity Works            基本的格式The Fundamental Pattern         使用Singleton还是不使用To Singleton Or Not To Singleton......&nbsp;&nbsp;<a href='http://www.blogjava.net/zhuyan/articles/108818.html'>阅读全文</a><img src ="http://www.blogjava.net/zhuyan/aggbug/108818.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhuyan/" target="_blank">朱岩</a> 2007-04-05 23:48 <a href="http://www.blogjava.net/zhuyan/articles/108818.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Velocity使用者指南</title><link>http://www.blogjava.net/zhuyan/articles/108693.html</link><dc:creator>朱岩</dc:creator><author>朱岩</author><pubDate>Thu, 05 Apr 2007 06:35:00 GMT</pubDate><guid>http://www.blogjava.net/zhuyan/articles/108693.html</guid><wfw:comment>http://www.blogjava.net/zhuyan/comments/108693.html</wfw:comment><comments>http://www.blogjava.net/zhuyan/articles/108693.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/zhuyan/comments/commentRss/108693.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhuyan/services/trackbacks/108693.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 目录    关于本指南    Velocity是什么?    Velocity能为我们做什么？What can Velocity do for me?            The Mud Store example         Velocity模版语言（VTL）:入门Velocity Template Language (VTL): An Introducti...&nbsp;&nbsp;<a href='http://www.blogjava.net/zhuyan/articles/108693.html'>阅读全文</a><img src ="http://www.blogjava.net/zhuyan/aggbug/108693.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhuyan/" target="_blank">朱岩</a> 2007-04-05 14:35 <a href="http://www.blogjava.net/zhuyan/articles/108693.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>