Jakarta Project: Velocity Template Engine Tag Library

Version: 1.0

Table of Contents

Overview
Requirements
Building the Library
Configuration
Tag Summary
Tag Reference
Examples
Javadocs
Revision History

Overview

The Velocity Template Engine allows the Velocity Template Language to be used within a JSP using JSP custom tags. Velocity is a general templating tool that provides a simple template language that allows easy access to java objects, methods, and data.

By allowing the use of Velocity from within a JSP, it allows a JSP author easy access to all public methods exposed by a Java class, as well as a simple set of control and logical directives.

Requirements

This custom tag library requires no software other than a servlet container that supports the JavaServer Pages Specification, version 1.1 or higher, and the Jakarta Velocity Template Engine, version 1.1 or higher.

Building the Library

Building the library is fairly straightforward. What to do :

Configuration

Follow these steps to configure your web application with this tag library:

To use the tags from this library in your JSP pages, add the following directive at the top of each page:

<%@ taglib uri="/WEB-INF/veltag.tld" prefix="vel" %>

where "vel" is the tag name prefix you wish to use for tags from this library. You can change this value to any prefix you like.

Tag Summary

velocity Processes the body as VTL. The body of the tag consists of normal Velocity template content. This content is a free mixture of VTL (Velocity Template Language) references and directives, as well as non-VTL content which is called 'schmoo'.
 

Tag Reference

velocityAvailability: version 0.01
Processes the body as VTL. The body of the tag consists of normal Velocity template content. This content is a free mixture of VTL (Velocity Template Language) references and directives, as well as non-VTL content which is called 'schmoo'.
 
Tag Classorg.apache.taglibs.velocity.VelocityTag
Tag BodyVelocity Template Language
Script VariableNo
Restrictions
Attributes 
 
NameRequiredRuntime Expression Evaluation
strictaccessfalsetrue
Example

  1. 
    <vel:velocity strictaccess="true">
      #set( $name = "Geir")
      Hello $name
    </vel:velocity>
    
    
    

Examples

See the example template in the distrubution /examples directory

Java Docs

To create the javadocs, use the 'javadoc' build target. The docs will be here.

Revision History

v0.01