- Apache Velocity
Infobox Software
name = Apache Velocity
caption =
developer =Apache Software Foundation
latest release version = 1.5
latest release date = release date|2007|03|06
latest preview version =
latest preview date =
operating system =Cross platform
programming language = Java
genre = template engine
license =Apache License 2.0
website = http://velocity.apache.orgApache Velocity is an
open source software project directed by theApache Software Foundation . Velocity is a Java-based template engine that provides a simple yet powerful template language to reference objects defined in Java code. Its aim is to ensure clean separation between the presentation tier and business tiers in aWeb application (seemodel-view-controller design pattern ).Some common types of applications which use Velocity are:*
Web application s:Web designer s createHTML pages withplaceholder s for dynamic information. The page is processed with [http://velocity.apache.org/tools/devel/view/ VelocityViewServlet] or any of a number of frameworks which support Velocity. This approach to web application development is calledModel-view-controller (MVC), and is intended to be a direct replacement for applications developed with JSP orPHP .
*Source code generation: Velocity can be used to generate Java source code,SQL , orPostScript , based on templates. The [http://wiki.apache.org/velocity/PoweredByVelocity PoweredByVelocity] page lists a number ofopen source , and commercial development software packages which use Velocity in this manner.
* Automaticemail s: Many applications generate automatic emails for account signup,password reminders, or automatically sent reports. Using Velocity, the email template can be stored in atext file , rather than directly embedded in Java code.
*XML transformation: Velocity provides an Ant task, called Anakia, which reads an XML file and makes it available to a Velocity template. A common application is to convertdocumentation stored in a generic "xdoc" format into a styled HTML document.Code example
The following template:
processed by Velocity will produce the following text:
The syntax and overall concept of the Apache Velocity templates is very similar to the syntax of the older
WebMacro template engine which is now also an open source project.ee also
*JSP
*FreeMarker External links
* [http://velocity.apache.org/ Velocity at Apache]
* [http://wiki.apache.org/velocity/ Velocity wiki]
Wikimedia Foundation. 2010.