??xml version="1.0" encoding="utf-8" standalone="yes"?>奇米影视在线99精品,最近中文字幕在线,91成人网在线http://www.aygfsteel.com/zhuyan/category/21312.htmlJAVA启发?/description>zh-cnFri, 06 Apr 2007 00:30:00 GMTFri, 06 Apr 2007 00:30:00 GMT60VTL指南http://www.aygfsteel.com/zhuyan/articles/108820.html朱岩朱岩Thu, 05 Apr 2007 15:50:00 GMThttp://www.aygfsteel.com/zhuyan/articles/108820.htmlhttp://www.aygfsteel.com/zhuyan/comments/108820.htmlhttp://www.aygfsteel.com/zhuyan/articles/108820.html#Feedback0http://www.aygfsteel.com/zhuyan/comments/commentRss/108820.htmlhttp://www.aygfsteel.com/zhuyan/services/trackbacks/108820.html关于该指南About this Guide

q是关于Velocity模版语言的指南。要得到更多的信息,请参阅Velocity 用户手册。This guide is the reference for the Velocity Template Language (VTL). For more information, please also refer to the Velocity User Guide.

参考References

变量Variables

合法的变量规则:Notation:

$ [ ! ][ { ][ a..z, A..Z ][ a..z, A..Z, 0..9, -, _ ][ } ]

例子QExamples:

  • Normal notationQ普通的写法Q如果mud-Slinger_9 不存在,则会昄mud-Slinger_9 Q? $mud-Slinger_9
  • Silent notationQ如果mud-Slinger_9 不存在,则不昄M东西Q? $!mud-Slinger_9
  • Formal notationQ正规的写法Q能最正确的区别变量名字): ${mud-Slinger_9}

    属性Properties

合法的规则:Notation:

$ [ { ][ a..z, A..Z ][ a..z, A..Z, 0..9, -, ]* .[a..z, A..Z ][ a..z, A-Z, 0..9, -, ]* [ } ]

例子 Examples:

  • Regular Notation: $customer.Address
  • Formal Notation: ${purchase.Total}

    ҎMethods

合法的规则Notation:

$ [ { ][ a..z, A..Z ][ a..z, A..Z, 0..9, -, ]* .[ a..z, A..Z ][ a..z, A..Z, 0..9, -, ]*( [ opional parameter list... ] ) [ } ]

例子QExamples:

  • Regular Notation: $customer.getAddress()
  • Formal Notation: ${purchase.getTotal()}
  • Regular Notation with Parameter ListQ带有参数的Ҏ的正规调用方式): $page.setTitle( "My Home Page" )
    VTL属性调用(get和setҎQ可以被写。比如_$object.getMethod()?object.setMethod()_ Ҏ都可以简写成_$object.Method_。在使用的时候,我们更偏好用后?即简化的写法。用调用方法这U写法的最大的好处在于你能向其中传递一些参数。VTL Properties can be used as a shorthand notation for VTL Methods that take get and set. Either $object.getMethod() or $object.setMethod() can be abbreviated as $object.Method. 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.

    语句Directives

#set - l一个引用赋值Establishes the value of a reference

格式QFormat:

#set( $*ref *= [ ", ' ]arg[ ", ' ] )

其中QUsage:

  • $ref - 左操作数应该是一个变量的引用或者一个属性的引用。The LHS of the assignment must be a variable reference or a property reference.
  • arg - x作,如果x作数是被双引hh的话Q那么在赋值给左操作数的时候,q回的是x作数解析出来的|如果x作数是被单引hh的话Q那么就直接赋值给左操作数。如果右操作数的解析的结果ؓnull的话Q不会给左操作数赋倹{The RHS of the assignment, arg is parsed if enclosed in double quotes, and not parsed if enclosed in single quotes. If the RHS evaluates to null , it is not assigned to the LHS.

例子QExamples:

  • 变量的引用:Variable reference: #set( $monkey = "bill" )
  • l属性赋|String literal: #set( $monkey.Friend = "monica" )
  • 属性赋|Property reference: #set( $monkey.Blame = $whitehouse.Leak )
  • Ҏ引用QMethod reference: #set( $monkey.Plan = $spindoctor.weave($web) )
  • Number literal: #set( $monkey.Number = 123 )
  • Range operator: #set( $monkey.Numbers = [1..3] )
  • Object array: #set( $monkey.Say = ["Not", $my, "fault"] )

x作数也可以是单的数学表达式,比如QThe RHS can also be a simple arithmetic expression, such as:

  • Addition: #set( $value = $foo + 1 )
  • Subtraction: #set( $value = $bar - 1 )
  • Multiplication: #set( $value = $foo * $bar )
  • Division: #set( $value = $foo / $bar )
  • Remainder: #set( $value = $foo % $bar )

    #if / #elseif / #else - output conditional on truth of statements条g控制语句

格式QFormat:

#if( [condition] ) [output] [ #elseif( [condition] ) [output] ]* [ #else [output] ] #end

其中QUsage:

  • condition - 如果是一个boolean的话Q则Ҏ值是true或者false来判断,如果不是一个booleanQ则条g的g为null则ؓtrue。If a boolean, considered true if it has a true false; if not a boolean, considered true if not null.
  • output - May contain VTL.

例子QExamples:

  • 相等操作Equivalent Operator: #if( $foo == $bar )
  • 大于Greater Than: #if( $foo > 42 )
  • 于Less Than: #if( $foo < 42 )
  • 不小于Greater Than or Equal To: #if( $foo >= 42 )
  • 不大于Less Than or Equal To: #if( $foo <= 42 )
  • 相等的值Equals Number: #if( $foo == 42 )
  • 相等的字W串Equals String: #if( $foo == "bar" )
  • 求反Boolean NOT: #if( !$foo )

    #foreach - Loops through a list of objects遍历一个列?/h2>

格式QFormat:

#foreach( $ref in arg ) statement #end

其中QUsage:

  • $ref - 遍历列表的当前引用。The first variable reference is the item.
  • arg - 一个列?比如一个对象数l,集合Qmap)Q或者数l列表,或者范围操作。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.
  • 语句statement - Ҏơ通过遍历得到的一个值得操作。What is output each time Velocity finds a valid item in the list denoted above as arg . This output is any valid VTL and is rendered each iteration of the loop.

下面是省略了处理语句?foreach()的例子:Examples of the #foreach(), omitting the statement block :

  • 引用QReference: #foreach ( $item in $items )
  • 数组QArray list: #foreach ( $item in ["Not", $my, "fault"] )
  • 范围QRange operator: #foreach ( $item in [1..3] )

Velocity提供了一个简单的得到循环ơ数的方法,所以你可以像下面这h作:Velocity provides an easy way to get the loop counter so that you can do something like the following:

<table>
 #foreach( $customer in $customerList )

<tr>

<td>$velocityCount</td>

<td>$customer.Name</td>

</tr>

#end

</table>
默认的计数的变量?velocityCountQ不q,你也能在velocity.properties文g中进行自q配置。默认的情况下,计数器是?开始的Q但是这也可以在velocity.properties文g中进行配|,也能?开始计数。下面是在velocity.properties文g中对计数器的名字和v始值配|的代码片断QThe 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:

# Default name of the loop counter
# variable refernce.

counter.name = velocityCount

# Default starting value of the loop

# counter variable reference.

counter.initial.value = 1

#include -不加解释的合成本地文件Renders local file(s) that are not parsed by Velocity

格式QFormat:

#include( arg[, arg2, ... argn] )

  • arg - Refers to a valid file under TEMPLATE_ROOT.

例子QExamples:

  • String: #include( "disclaimer.txt", "opinion.txt" )
  • Variable: #include( $foo, $bar )

什么叫不加解释?是说velocity只是把这个文件的内容直接合成到指定的位置Q而如果在q个文g中也有VTL的语句,是不会翻译的。如果要实现q个功能Q要用到下面?parse?/p>

#parse - 解释的合成本地模版Renders a local template that is parsed by Velocity

格式QFormat:

#parse( arg )

  • arg - Refers to a template under TEMPLATE_ROOT.

例子QExamples:

  • String: #parse( "lecorbusier.vm" )
  • Variable: #parse( $foo )

q里允许递归的调用。你可以在velocity.properties中改?em>parse_directive.maxdepth 的值来定允许递归的层数。(默认的gؓ10QRecursion permitted. See parse_directive.maxdepth in velocity.properties to change from parse depth. (The default parse depth is 10.)

#stop - 停止模版引擎Stops the template engine

格式QFormat:

#stop

Usage:

q个Ҏ能停止执行当前的模版Q很适合用于DEBUG。This will stop execution of the current template. This is good for debugging a template.

#macro - 允许用户定义一个Velocity宏(VMQ,能重用一些操作。Allows users to define a Velocimacro (VM), a repeated segment of a VTL template, as required

格式QFormat:

#macro( vmname $arg1 [ $arg2 $arg3 ... $argn ] ) [ VM VTL code... ] #end

  • vmname - 宏的名字。Name used to call the VM ( #vmname )
  • $arg1 $arg2 [ ... ] - 传递给VM的参数列表。参数的个数不限Q但调用时候传入的参数必须和定义宏的时候规定的参数个数相同。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.
  • [ VM VTL code... ] - 合法的VTL代码。Q何能攑֜模版中的代码都能攑֜VM里面。Any valid VTL code, anything you can put into a template, can be put into a VM.

如果宏一旦定义,可以像下面q样调用QOnce defined, the VM is used like any other VTL directive in a template.

#vmname( $arg1 $arg2 )
VM可以在下面两个地方定义:VMs can be defined in one of two places:

  1. Template library: can be either VMs pre-packaged with Velocity or custom-made, user-defined, site-specific VMs; available from any template
  2. Inline: found in regular templates, only usable when velocimacro.permissions.allowInline=true in velocity.properties .

    注释Comments

被注释了的内容不会被合成。Comments are not rendered at runtime.

单行的注释Single Line

Example:

## This is a comment.

多行的注释Multi Line

Example:

#*
This is a multiline comment.
This is the second line
*#



朱岩 2007-04-05 23:50 发表评论
]]>
Velocity在Web http://www.aygfsteel.com/zhuyan/articles/108819.html朱岩朱岩Thu, 05 Apr 2007 15:49:00 GMThttp://www.aygfsteel.com/zhuyan/articles/108819.htmlhttp://www.aygfsteel.com/zhuyan/comments/108819.htmlhttp://www.aygfsteel.com/zhuyan/articles/108819.html#Feedback0http://www.aygfsteel.com/zhuyan/comments/commentRss/108819.htmlhttp://www.aygfsteel.com/zhuyan/services/trackbacks/108819.html用Velocity构徏一个Web应用

Velocity在应用中通常用于生成面Q来直接代替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:

  • 单Simplicity -没有多少技术的Web设计者就能书写这些页面?The pages can be written and maintained by non-technical web designers.
  • Ҏl护Ease of maintainance - 使用推荐的MVC开发模式,程序(scriptQ不再出现在Web面中。Scripting is removed from web pages with the recommended MVC approach.
  • Ҏ法和属性的讉KAccess both methods and properties - Web设计者可以访问上下文中一个对象的属性和Ҏ。Web designers can reference methods as well as properties of objects in a context.
  • 一致性Consistency -Velocity可以被用作其他的文本生成工作Q比如发送emailQ,q提供了一致的标记语言?Velocity can be used for other text generation tasks (such as sending email) providing a consistent way to mark up text.

q篇文档中提供了一些将Velocity用于Web应用中的基本信息。This document provides some basic info on getting started with Velocity in a web application.

使用一个框?/h1>

Velocity引擎的主要功能是Z一个模版生成文本。因此,Velocityq没有包含Q何与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. 要创Z个Web应用Q你需要一个框架来响应HTTPhQ处理用戯证,调用业务逻辑Qƈ且返回响应。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.

  1. Velocity Tools / VelocityViewServlet - 最单的开始的Ҏ是下载Velocity Tools子项目,使用VelocityViewServlet。这个servlet的配|和安装都很单。The easiest way to get started is to download the companion Velocity Tools subproject and use the VelocityViewServlet . This servlet is easy to configure and install.你需要在web服务器上创徏一个模版的目录Qƈ~辑一个包含了需要放|在上下文中?Tools"的列表的XML文gp了。具体的l节请参见下面的指南?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.
  2. Velocity Tools / VelocityStruts - 也许你对行的Struts框架比较熟悉。Struts最开始是Z设计一个ؓ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>VelocityStruts模块的帮助下Q你可以用Velocity代替JSP作ؓ面的模版语a。这允许你用Struts强大的基设施的好处的同时Q用Velocity设计面?With the VelocityStruts 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.
  3. W三Ҏ架Third party frameworks - q有许多的第三方框架?span class=nobr>PoweredByVelocity wiki 面上。There are a number of third party frameworks listed on the PoweredByVelocity wiki page. 在其中,Spring可能是被公认的最先进的框架了。Of these, Spring is probably the most sophisticated and well known. Jakarta Turbine 有许多特点ƈ且也很有用,它基于Velocityq用Velocity作ؓ主要的页面语aQ这q不奇怪,因ؓ有许多Velocity的早期开发者在开发和l护它。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框架QMaverick提供了一个很好的集成了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.
  4. 构徏你自qBuild your own - 最后的一个选择是创Z自己的框架。A final alternative is to build your own framework.建立一个{发servletQDispatcher servletQ,从一个文件或者数据库中检索出模版Q集成你自己的商务逻辑Qƈq回l果l用戗?Create a dispatcher servlet, retrieve templates from a file or database, integate with your business logic and send the results back to the user. 从一个已有的框架出发q扩展它通常是一更简单的Ҏ。特别的Q你只需要ؓVelocityViewServlet创徏一个子c,既能向其中添加新的功能。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 VelocityViewServlet simply by creating a subclass.

Z一提,你可能偶然发?span class=nobr>VelocityServletq个c,该对象是一个在Velocity 1.4版本中不提倡用的servlet?span class=nobr>VelocityServlet已经不再l护Q所以,我们强烈你用Velocity Tools中的VelocityViewServlet。As a side note, you may also come across references to VelocityServlet, which is a deprecated servlet that was included in the Velocity Engine up to version 1.4. Since VelocityServlet is no longer being maintained we strongly recommend you use VelocityViewServlet in Velocity Tools instead.

Web斚w的问题Web-Specific Issues

对于Velocity在web的应用,有一些问题需要讨论。这些都是经帔R到的问题中的一些简单的讨论。There are a few issues with Velocity that are specific to web applications. Here is a brief discussion of the most commonly encountered issues.

不要改变对象的状态Changing Object State - Don't!

在Velocity中,如果一个对象作Z个引用,那么Velocity提供了访问该对象的Q何方法的能力。在面中显CZ息的时候,q个功能很有用,但是同时如果对象或者应用的状态被改变了,q样做也是很危险的。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.

举个例子Q下面的代码安全的调用了一个list的size()Ҏq显C结果。For example, the following code safely calls the size() method of a list and displays the result.

There are $users.size() currently logged in.
一个不安全调用的例子:在一个胦务web面上,在上下文中的一个对象能计算每一q的数据。方法calculateNextYear()Ҏ能计下一q的数据q将一个内部的计数器做增加操作。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:

2005 data: $table.data
$table.calculateNextYear()

2006 data: $table.data
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.

我们强烈的实跉|只用Velocity向文本中插入信息。方法调用会是得C息的一个有效的ҎQ但一般说来用一个方法调用来改变对象的状态是一个不良的观念Q来改变应用的状态一定是一个错误的x。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.

如果你必需要改变对象的状态(比如前面的例子)Q可以预先计出所有可能的值ƈ攑օ一个List或则Map对象中。所有的要改变应用的状态的动作应该L攑֜控制器中。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.

一个相关的注意Q你应该在上下文对象中放入一个List或者一个Set对象Q而不是放入一个Iterator或者Enumeration。这样允讔R合对象在没有改变旉复用。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.

LHTML/XML标记Escaping HTML/XML Entities

M用户d的带有HTML或者XML标记Q比?lt;,>,&Q的文本都应该在填到web面之前被去掉。ؓ了确保页面正显C和避免危险的跨站点脚本Qcross-site scripting一U攻LD,在页面中包含另一个带有木马的面Q。不象JSTLQJava标准标记语言Q,Velocity不包含去除HTML标记的功能,但是你可以通过三种Ҏ来达到目的。Any user-entered text that contains special HTML or XML entities (such as <, >, or &) 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:

  1. 创徏一?Tool"Qƈ且包含一个能LHTML标记的方法。比?$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.
  2. 创徏一个自定义?span class=nobr>ReferenceInsertionEventHandler Q能自动的去掉所有引用中的HTML标签。如果所有的引用中的内容都需要被查ƈLHTML标签Q那么这样做是最省事的。Create a custom ReferenceInsertionEventHandler that automatically escapes every reference. If all references need to be escaped, this is the most painless method.
  3. 创徏一个自定义的标识,比如#escapeQ来L在该标识寚w面的所有引用中的HMTL标签。Create a custom directive (e.g. #escape) that escapes all text within the directive block.

注意Q有时候其他的标记也需要被L。比如在CSS里面Q@需要被LQ在JavascriptQ单独的'W号需要从字符串中L或替换。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.

应用的安全Securing the Application

当一个web应用在服务器上开始运行了Q有了若q的用户和一些受保护的资源,q时候,应用的安全性方面的要求显现出来了。Velocity中已l涵盖了大多数标准的web安全性标准。一些特别的问题Q比如系l配|,跨站点脚本,或者方法自省){都在Building Secure Applications with Velocity q篇文章上有所介绍。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.

日志文gLog Files

q有一点就是Velocity在日志方面的配置比较~Z。他L在当前文件夹中创Z个日志文件。当Velocity用在Web应用中的时候,当前文gҎ的是应用开始的那个文g夏V如果你发现"velocity.log"q个文g出现在你文gpȝ的不固定位置Q请查你的Velocity 日志的配|。一般情况下Q出现这个问题的原因是在除了面生成之外的其他地方还使用了VelocityQ比如发送邮Ӟ。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).

指南Tutorial

下面是一个介l?a title=VelocityViewServlet >VelocityViewServlet来徏立一个简单的web应用的简要教E。更多的信息请参见Velocity Tools 的文档。What follows is a brief tutorial on building a simple web app with VelocityViewServlet. For more information, consult the Velocity Tools documentation.

  1. ?download page 下蝲Velocity Tools目的源代码。里面包含了下面介绍的这个例子的代码。Download the Velocity Tools project source (you need the source for the examples) from download page .
  2. L保你?Apache Ant 环境安装正确。If you haven't already installed Apache Ant . do so now.
  3. 使用下面的指令来构徏VelocityTools的jar包和"simple"CZ。Build the Velocity Tools jar and the "simple" example by typing: ant example.simple
  4. 察看"examples"文g夹,在里面你会发C个叫"index.vm"的文Ӟ下面是这个文件的摘录QTake a look at the "examples" directory. You will see a file "index.vm". Here's an excerpt: <html> <body> I'm a velocity template.
    #if( $XHTML )
    #set( $br = "<br />" )
    #else
    #set( $br = "<br>" )
    #end
    $br $br
    Here we use a custom tool: $toytool.message
    $br $br
    Here we get the date from the DateTool: $date.medium
    </body>
    </html>
    你可以复制其他的velocity模版文g到这个文件夹里面。在examples/WEB-INF文g夹下Q你会发C?toolbox.xml"文gQ在q个文g里面定义了自动攑֜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. <toolbox> <xhtml>true</xhtml>
    <tool>
    <key>toytool</key>
    <class>ToyTool</class>
    </tool>
    <data type="number">
    <key>version</key> <value>1.1</value>
    </data>
    <data type="boolean">
    <key>isSimple</key> <value>true</value>
    </data>
    <data type="string">
    <key>foo</key> <value>this is foo.</value>
    </data>
    <data type="string">
    <key>bar</key> <value>this is bar.</value>
    </data>
    <tool>
    <key>map</key>
    <class>java.util.HashMap</class>
    </tool>
    <tool>
    <key>date</key>
    <scope>application</scope> <class>org.apache.velocity.tools.generic.DateTool</class> </tool>
    </toolbox>  
    最后,应用的web.xml文g里面定义了接受请求的servlet和toolbox的配|文件位|。And finally the web.xml file specifies the name of the servlet and location of toolbox.properties. <web-app> <servlet>
    <servlet-name>velocity</servlet-name>
    <servlet-class> org.apache.velocity.tools.view.servlet.VelocityViewServlet </servlet-class>
    <init-param>
    <param-name>org.apache.velocity.toolbox</param-name>
    <param-value>/WEB-INF/toolbox.xml</param-value> </init-param>
    <load-on-startup>10</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>velocity</servlet-name>
    <url-pattern>*.vm</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
    <welcome-file>index.vm</welcome-file>
    </welcome-file-list>
    </web-app>
  5. 这个文件夹拯CTomcat的webapps文g夹下Q请拯整个文g夹(而不光是simple.warQ会让你更容易通过改变或者添加一些东西来做些实验。现在,你可以通过下面的地址来访问页面了。(地址随着你的目的名字改变)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): http://localhost:8080/simple/index.vm
  6. 试d一些新的Velocity面。注意,你只需要改变访问的URL地址可以访问新的页面了。尝试改变toolbox.xml中的一些内容,或者向其中d你自qTools。察看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.


朱岩 2007-04-05 23:49 发表评论
]]>
Velocity开发者指?/title><link>http://www.aygfsteel.com/zhuyan/articles/108818.html</link><dc:creator>朱岩</dc:creator><author>朱岩</author><pubDate>Thu, 05 Apr 2007 15:48:00 GMT</pubDate><guid>http://www.aygfsteel.com/zhuyan/articles/108818.html</guid><wfw:comment>http://www.aygfsteel.com/zhuyan/comments/108818.html</wfw:comment><comments>http://www.aygfsteel.com/zhuyan/articles/108818.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/zhuyan/comments/commentRss/108818.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/zhuyan/services/trackbacks/108818.html</trackback:ping><description><![CDATA[     摘要: 概述和入门Introduction and Getting Started 资源Resources Velocity怎样工作How Velocity Works 基本的格式The Fundamental Pattern 使用Singletonq是不用To Singleton Or Not To Singleton... ...  <a href='http://www.aygfsteel.com/zhuyan/articles/108818.html'>阅读全文</a><img src ="http://www.aygfsteel.com/zhuyan/aggbug/108818.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/zhuyan/" target="_blank">朱岩</a> 2007-04-05 23:48 <a href="http://www.aygfsteel.com/zhuyan/articles/108818.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Velocity使用者指?/title><link>http://www.aygfsteel.com/zhuyan/articles/108693.html</link><dc:creator>朱岩</dc:creator><author>朱岩</author><pubDate>Thu, 05 Apr 2007 06:35:00 GMT</pubDate><guid>http://www.aygfsteel.com/zhuyan/articles/108693.html</guid><wfw:comment>http://www.aygfsteel.com/zhuyan/comments/108693.html</wfw:comment><comments>http://www.aygfsteel.com/zhuyan/articles/108693.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/zhuyan/comments/commentRss/108693.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/zhuyan/services/trackbacks/108693.html</trackback:ping><description><![CDATA[     摘要: 目录 关于本指? Velocity是什? Velocity能ؓ我们做什么?What can Velocity do for me? The Mud Store example Velocity模版语言QVTLQ?入门Velocity Template Language (VTL): An Introducti...  <a href='http://www.aygfsteel.com/zhuyan/articles/108693.html'>阅读全文</a><img src ="http://www.aygfsteel.com/zhuyan/aggbug/108693.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/zhuyan/" target="_blank">朱岩</a> 2007-04-05 14:35 <a href="http://www.aygfsteel.com/zhuyan/articles/108693.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">཭</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">»</a>| <a href="http://" target="_blank">ƽɽ</a>| <a href="http://" target="_blank">۩</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">˼</a>| <a href="http://" target="_blank">ľ</a>| <a href="http://" target="_blank">ַ</a>| <a href="http://" target="_blank">Ϫ</a>| <a href="http://" target="_blank">ؼ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">״</a>| <a href="http://" target="_blank">α</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">˰</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ո</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ˮ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ҧ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank">Դ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ϫ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>