Jump to content

Apache Velocity: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
tidy
Filling in 1 reference using Reflinks; formatting: 9x whitespace, 2x heading-style (using Advisor.js)
Line 6: Line 6:
| screenshot =
| screenshot =
| caption =
| caption =
| developer = [[Apache Software Foundation]]
| developer = [[Apache Software Foundation]]
| latest release version = 1.6.3
| latest release version = 1.6.3
| latest release date = {{release date|mf=yes|2009|12|16}}
| latest release date = {{release date|mf=yes|2009|12|16}}
Line 13: Line 13:
| operating system = [[Cross platform]]
| operating system = [[Cross platform]]
| programming language = [[Java (programming language)|Java]]
| programming language = [[Java (programming language)|Java]]
| genre = [[template engine (web)|template engine]]
| genre = [[template engine (web)|template engine]]
| license = [[Apache License]] 2.0
| license = [[Apache License]] 2.0
| website = http://velocity.apache.org
| website = http://velocity.apache.org
}}
}}

'''Apache Velocity''' (formerly known as Jakarta Velocity) is an [[open source]] software project directed by the [[Apache Software Foundation]]. Velocity is a [[Java (programming language)|Java]]-based [[template engine (web)|template engine]] that provides a simple yet powerful [[Web template#Template languages|template language]] to reference [[object (computer science)|object]]s defined in Java code. Its aim is to ensure clean separation between the presentation tier and business tiers in a [[Web application]] (the [[model-view-controller design pattern]]).
'''Apache Velocity''' (formerly known as Jakarta Velocity) is an [[open source]] software project directed by the [[Apache Software Foundation]]. Velocity is a [[Java (programming language)|Java]]-based [[template engine (web)|template engine]] that provides a simple yet powerful [[Web template#Template languages|template language]] to reference [[object (computer science)|object]]s defined in Java code. Its aim is to ensure clean separation between the presentation tier and business tiers in a [[Web application]] (the [[model-view-controller design pattern]]).


Line 24: Line 25:


* [[Web application]]s: [[Web designer]]s create [[HTML]] pages with [[placeholder]]s for dynamic information. The page is processed with ''VelocityViewServlet'' or any of a number of frameworks which support Velocity. This approach to web application development is called [[Model-view-controller]] (MVC), and is intended to be a direct replacement for applications developed with [[JavaServer Pages|JSP]] or [[PHP]].
* [[Web application]]s: [[Web designer]]s create [[HTML]] pages with [[placeholder]]s for dynamic information. The page is processed with ''VelocityViewServlet'' or any of a number of frameworks which support Velocity. This approach to web application development is called [[Model-view-controller]] (MVC), and is intended to be a direct replacement for applications developed with [[JavaServer Pages|JSP]] or [[PHP]].
* [[Source code]] generation: Velocity can be used to generate Java source code, [[SQL]], or [[PostScript]], based on [[Web template|templates]]. A number of [[open source]] and commercial development [[Software package (installation)|software packages]] use Velocity in this manner.<ref>http://wiki.apache.org/velocity/PoweredByVelocity</ref>
* [[Source code]] generation: Velocity can be used to generate Java source code, [[SQL]], or [[PostScript]], based on [[Web template|templates]]. A number of [[open source]] and commercial development [[ package (installation)|software packages]] use Velocity in this manner.<ref>http://wiki.apache.org/velocity/PoweredByVelocity</ref>
* Automatic [[email]]s: Many applications generate automatic emails for account signup, [[password]] reminders, or automatically sent reports. Using Velocity, the email [[web template|template]] can be stored in a [[text file]], rather than directly embedded in Java code.
* Automatic [[email]]s: Many applications generate automatic emails for account signup, [[password]] reminders, or automatically sent reports. Using Velocity, the email [[web template|template]] can be stored in a [[text file]], rather than directly embedded in Java code.
* [[XML]] transformation: Velocity provides an [[Apache Ant|Ant]] task, called Anakia, which reads an XML file and makes it available to a Velocity template. A common application is to convert [[documentation]] stored in a generic "xdoc" format into a styled HTML document.
* [[XML]] transformation: Velocity provides an [[Apache Ant|Ant]] task, called Anakia, which reads an XML file and makes it available to a Velocity template. A common application is to convert [[documentation]] stored in a generic "xdoc" format into a styled HTML document.
Line 55: Line 56:
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.
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.


==See also==
==See also==
*[[Apache Torque]]
*[[Apache Torque]]
*[[JavaServer Pages|JSP]]
*[[JavaServer Pages|JSP]]
Line 63: Line 64:
{{reflist}}
{{reflist}}


==Bibliography==
==Bibliography==
{{refbegin}}
{{refbegin}}
*{{citation
*{{citation
| first1 = Rob
| first1 = Rob
| last1 = Harrop
| last1 = Harrop
| first2 = Ian
| first2 = Ian
| last2 = Darwin
| last2 = Darwin
| date = August 30, 2004
| date = August 30, 2004
| title = Pro Jakarta Velocity: From Professional to Expert
| title = Pro Jakarta Velocity: From Professional to Expert
| edition = 1st
| edition = 1st
| publisher = [[Apress]]
| publisher = [[Apress]]
| pages = 370
| = 370
| isbn = 978-1590594100
| isbn = 978-1590594100
| url = http://www.apress.com/book/view/9781590594100
| url = http://www.apress.com/book/view/9781590594100
Line 81: Line 82:
| first1 = Jim
| first1 = Jim
| last1 = Cole
| last1 = Cole
| first2 = Joseph
| first2 = Joseph
| last2 = D. Gradecki
| last2 = D. Gradecki
| date = July 16, 2003
| date = July 16, 2003
| title = Mastering Apache Velocity
| title = Mastering Apache Velocity
| edition = 1st
| edition = 1st
| publisher = [[John Wiley & Sons|Wiley]]
| publisher = [[John Wiley & Sons|Wiley]]
| pages = 372
| = 372
| isbn = 978-0471457947
| isbn = 978-0471457947
| url = http://www.wiley.com/WileyCDA/WileyTitle/productCd-0471457949.html
| url = http://www.wiley.com/WileyCDA/WileyTitle/productCd-0471457949.html

Revision as of 08:51, 29 March 2010

Apache Velocity
Developer(s)Apache Software Foundation
Stable release
1.6.3 / December 16, 2009 (2009-12-16)
Repository
Written inJava
Operating systemCross platform
Typetemplate engine
LicenseApache License 2.0
Websitehttp://velocity.apache.org

Apache Velocity (formerly known as Jakarta Velocity) is an open source software project directed by the Apache 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 a Web application (the model-view-controller design pattern).

Uses

Some common types of applications which use Velocity are:

  • Web applications: Web designers create HTML pages with placeholders for dynamic information. The page is processed with VelocityViewServlet or any of a number of frameworks which support Velocity. This approach to web application development is called Model-view-controller (MVC), and is intended to be a direct replacement for applications developed with JSP or PHP.
  • Source code generation: Velocity can be used to generate Java source code, SQL, or PostScript, based on templates. A number of open source and commercial development software packages use Velocity in this manner.[1]
  • Automatic emails: Many applications generate automatic emails for account signup, password reminders, or automatically sent reports. Using Velocity, the email template can be stored in a text 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 convert documentation stored in a generic "xdoc" format into a styled HTML document.

Code example

The following template:

## Velocity Hello World
<html>
    <body>
       #set( $foo = "Velocity" )
       ## followed by
       Hello $foo World!
    </body>
</html>

processed by Velocity will produce the following text:

<html>
    <body>
     Hello Velocity World!
    </body>
</html>

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.

See also

References

  1. ^ "PoweredByVelocity". Velocity Wiki. Wiki.apache.org. 2009-12-30. Retrieved 2010-03-29.

Bibliography

External links