Velocity
Velocity is a Java-based template engine. It permits web page designers to reference methods defined in Java code.
Velocity is a Java-based template engine. It permits web page designers to reference methods defined in Java code.
Velocity

Apache Velocity is template engine developed by apache foundation for
the development of views using the templates. Velocity provides many
features for easy development of view using the templates.
Developers can use this engine with any type of Java programs. Event a
desktop application developed in Java can use the Velocity templates for
generating formatted output.
In web applications it is mostly used to generate the view part of the web
applications. In this tutorial you will learn Velocity template with the help of
many examples.
- What is Velocity?
Velocity is a Java-based template engine. It permits web page designers to reference methods defined in Java code. At the Jakarta Velocity Project Website, where you can download the freely available source code, a thriving and growing community of users is ready to answer questions and offer solutions to common templating problems.
- Call class methods
This Example shows you
how
to call class method in velocity template.
- Calculation Example
This Example shows,
how to calculate using velocity. This code displays the product name and
their price with the total amount of all product.
- Reference Class Properties
This
Example shows you how
to use class properties in your velocity template.
- XML handling in a template using Velocity
This Example shows you
how
to use XML file in a velocity template and
also shows that use of macro to wrap HTML tag in
velocity
template.
- Show output as a xml file using Velocity
This
Example shows you how
to show output as a xml file in velocity.
- Define and use Macro in Velocity
This
Example shows you how
to define and use macro in velocity template and also shows how
to use Iterator in velocity
template.
- Show content of
.vm file as output using Velocity
This
Example shows you how
to display content of .vm file using velocity and also shows how
to use Iterator in velocity
template.
- How to pass java.util.Properties in properties
This
Example shows you how
to use
java.util.Properties to in velocity.
- How to use Map in velocity
This
Example shows you how
to use map in velocity.
- Velocity Macro with Parameters
This
Example shows you how
to use macro with parameters in velocity
template.
- Use macro to wrap HTML tags in velocity
This
Example shows you how
to use
macro to wrap HTML tag in
velocity
template.
- How to use foreach loop in velocity
This
Example shows you how
to use foreach loop in velocity
template.
- How to use List in velocity
This
Example shows you how
to use List in velocity.
- Velocity Iterator Tool Example
This
Example shows you how
to use Iterator in velocity
template.
- Include template file in another template file
This Example shows you how
to include another template file.
- Velocity with External Properties
This Example shows you how to use Velocity with External Properties.
- Date Tool Example
This Example shows you how to display date and time velocity.
- Use if and elseif statements in velocity
This Example shows you how
to use If and elseif in velocity.
- Use if else and end statements in velocity
This Example shows you how
to Use if in velocity.
- Use if in velocity
This example shows you how
to use if statement in velocity.
- How to define variable in Velocity
This Example shows you how
to define a variable in velocity.
- How to set a variable value using velocity
This Example shows you how
to set variable value using velocity.
- Foreach loop with negative index
in velocity
This Example shows you how to
use foreach loop with negative index in velocity.
- Use Velocity to generate HTML document
This Example shows you how
to generate HTML document using velocity.
- Data Type: String
This Example shows you how
to use string data type in velocity.
- Data Type: number
This Example shows you how
to use number data type in velocity.
- Data Type: bool
This Example shows you how
to use bool datatype in velocity.
- How to use dollar sign in
velocity
This Example shows you how to
use dollar sign in velocity.
Ads