3.2 References

Velocity references are the glue which connect templates to the application. Template designers and application developers must agree on a common set of references used by the Java application and the Velocity templates. Every Velocity reference represents a Java object.

A Velocity reference starts with a $ character followed by an identifier name.

Example 3.3. Velocity References

## Simple reference
The total amout is $total.

## Property reference
You currently have $cart.items Items in your Shopping cart.

## Method reference
We offer you a discount of $cart.calculateDiscount() for your purchase.

## Creating a new reference from Velocity
#set($linesPerPage = 20)

If you need to separate a reference identifier name from the surrounding template, you can wrap the reference identifier in curly braces ({ and }):

The total amout is ${total}.

You currently have ${cart.items} Items in your Shopping cart.

Velocity references are discussed in depth in the References chapter.