Sunday, November 18, 2007

Velocity Framework

What is Velocity Framework?
Velocity is a Java based template engine.It permits anyone to use a simple yet powerful template language to reference objects defined in Java code.Velocity is inspired from 'WebMacro' , an alternative to JSP,PHP and ASP(

Where can Velocity be used?

Velocity framework can be used in following areas:
- Web apps, dynamic HTML pages are created and processed with VelocityViewServlet or number of frameworks that support Velocity
- Source code generation
- Automatic e-mails
- XML transformation, provides an ant task called Anakia which reads an XML file and makes it available to a Velocity template.

What are the features of Velocity?
Velocity framework has following features:
- Velocity is MVC based
- It segregates HTML template code from Java code
- It emphasizes on role based web app development
- Velocity offers better maintainable web applications

How Velocity works?
When using Velocity in an application program or in a servlet (or anywhere, actually), you will generally do the following :
- Initialize Velocity. This applies to both usage patterns for Velocity, the Singleton as well as the 'separate runtime instance', and you only do this once.
- Create a Context object.
- Add your data objects to the Context.
- Choose a template.
- 'Merge' the template and your data to produce the output.

An Emailing template creation using Velocity framework
Velocity With XML


VaishaliKulkarni on June 4, 2009 at 11:14 AM said...

This is very preliminary info on velocity framework.. Can you please mention some good site where I can find the details about the features and how to use them about velocity? Other than the user guild provided by :

Deepun on June 8, 2009 at 9:45 AM said...

As you are aware the most of Velocity info is available on, besides this you may refer following links:

Velocity on OSCON2007

Advanced Velocity


Interview Questions On Java,Java EE Copyright © 2016. Reads: best tracker