Velocity Terms and Abbreviations¶
- Anakia¶
- An XML transformation tool that uses JDOM and Velocity to transform XML documents into the format of your choice.
- Block Directive¶
- A directive that spans multiple lines. The block starts with a block directive such as
#if
,#foreach
, or#macro
and ends with the#end
directive. - #break¶
- A directive that stops the rendering of the current (innermost) content directive or a specified content directive if the scope control provided for that content directive is passed to #break as an argument: (e.g. #break($foreach.parent)).
- Comment¶
- Allow descriptive text to be included in the template that will not be placed into the output of the template engine. Single line comments begin with
##
. Multi-line comments begin with#*
and end with*#
- Content Directive¶
- A directive that outputs content when rendering a template. The default ones automatically have a scope control made available in the context during their rendering.
- Context¶
- A means to import Java objects into a Velocitytemplate.
- Directive¶
- Easy to use "active" elements that manipulate template output. There are both line and block directives.
- DocBook Framework¶
- A framework inteded to help create high quality documentation suitable for online viewing and printing.
- DVSL¶
- Declarative Velocity Style Language. A tool modeled after XSLT that is used for general XML transformations using the VTL as the templating language.
- #else¶
- A directive that must be used with an
<a href="#if">#if</a>
. It allows text to be included only if the#if
was false. - #elseif¶
- A directive that must be used with an
#if
. It allows text to be included if the#if
was false and if its own statement is true. - Equivalence Operator¶
==
Used to directly compare numbers, strings, or objects. If the objects that are being compared are different classes,toString()
is called first and then they are compared.- #end¶
- Ends block directives such as #if, #foreach and #macro.
- Escaping¶
- Removing the special meaning of a
#
or$
so that you can use these characters without Velocity interpretting it as the start of a reference or directive. Escaping is done by putting a\
character before the#
or$
. - #{evaluate¶
- A directive which dynamically evaluates a string literal or reference.
- #foreach¶
- A directive that allows you to repeat something on every value in a Collection, Array, Iterable, Map or (as of Velocity 1.6+) object with a
public Iterator iterator()
method. - #include¶
- A directive that allows the template designer to import a local file, which is then inserted into the location where the
#include
directive is defined. Multiple files may be included by seperating the file names with commas. - Identifier¶
- The name of a variable. Identifiers must start with an alphabetic character (a .. z, A .. Z). The rest of the characters are limited to alphabetic, numberic (0 .. 9), hyphens ("-"), and underscores ("_").
- #if¶
- A directive that allows for text to only be included if a statement is true.
- Formal Reference Notation¶
- A notation for references that is more formal than the shorthand. The formal notation consists of a
$
character followed by a{
character and then the identifiers used in the shorthand notation and then a}
character. Formal notation is often useful when references are directly adjacent to text in a template. - LHS¶
- Left Hand Side of an assignment.
- Line Directive¶
- A directive that is done all on one line, such as
#set
. - Literal¶
- A string enclosed in double quotes.
- #macro¶
- See Velocimacro.
- Method¶
- A type of reference. Methods are defined in the Java code and are capable of doing something useful. The shorthand notation consists of a leading
$
character followed by an identifier, folowed by a VTL Method Body. - MVC¶
- Model-View-Controller design pattern. Allows web page designers to focus on creating a well-designed site and allows programmers to focus on writing good code.
- #parse
- A directive that includes a local file that contains VTL. Velocity then parses the VTL and renders the template.
- Property¶
- A type of reference. The shorthand notation consists of a leading
$
character followed by an identifier, followed by a.
character and another identifier. - Quiet Reference Notation¶
- Another notation for references. A
!
character is inserted between the$
and the identifier. This overrides Velocity's default behavior if the reference is undefined. Normally, if a reference is undefined, the name of the reference that was given is used instead. With this notation, a blank text field is used. - Reference¶
- Begins with
$
and are used to get something. There are three types: variables, properties, and methods. - Resource¶
- A general text resource that can be loaded from a variety of sources using a Resource Loader.
- Resource Loader
- A class used by a Velocity Engine to load resources from the file system, classpath, URLs or even a database depending on the implementation.
- RHS¶
- Right Hand Side of an assignment.
- Scope Control¶
- The reference automatically provided as a way of scoping/namespacing references (to avoid polluting the global context) within the given content directive and also providing a "label" for #break to use when breaking out of multiple content directives at once.
- #set¶
- The directive that is used for setting the value of a reference.
- #stop¶
- A directive that stops the execution of the template engine.
#stop
is useful for debugging templates. - String Interpolation¶
- Using a variable inside of a string. For example,
"Hello $name"
would be "Hello" and then whatever value is stored in$name
. - Template¶
- A file containing code in a template language such as the VTL that can be run through a template engine like Velocity to produce dynamic output.
- Template Engine¶
- An engine that merges a context with a template to produce output.
- Template Language¶
- A language such as the VTL that can be used to create templates.
- Texen¶
- Texen is a general purpose text generating utility that is driven by Ant.
- Tool¶
- A plain old Java object that is useful in a template but it is not meant to be rendered in output. Tools are meant to be used but not to be seen.
- Turbine¶
- A servlet based framework that allows experienced Java developers to quickly build web applications. Turbine allows you to personalize the web sites and to use user logins to restrict access to parts of your application.
- Variable¶
- A type of reference. Variables represents values that can change. The shorthand notation consists of a leading
$
character followed by an identifier. - Velicomacro¶
- The
#macro
directive allows designers to define a repeated segment of template. To create a macro "d", you would use#macro(d)
followed by the segment of template followed by#end
. Macros can have as many arguments as necessary by adding them inside the parentheses such as#macro(d $arg1 $arg2)
. - Velocity¶
- A Java-based template engine.
- Velocity Engine¶
- The engine that generates web pages and other output from templates containing VTL code.
- Velocity Singleton¶
- A singleton wrapper around a velocity engine that is shared across the JVM (or ClassLoader) and may thus be referenced directly without needing to pass an instance around. This allows localized configuration and sharing of resources.
- VelocityTools¶
- A collection of Tools and infrastructure to easily, automatically and transparently make tools and static data available to Velocity templates.
- VTL¶
- Velocity Template Language. The powerful template language that is used with Velocity.
- VTL Method Call
- Consists of an identifier followed by a
(
character, followed by an optional parameter list, followed by a)
character. VTL allows template designers to call any public method declared in a public class on values placed in the context.