4. References

There are three types of references in the VTL: variables, properties and methods. They are the glue that connects the business logic of your application written in Java to your templates. The Java code and the templates must use the same set of references, so you, as a template designer and the developers writing the application logic must agree on the references available for use on the templates.

Every reference that is output when a template is rendered, is converted to a Java string by calling the toString() method on the Java object which represents the reference. If you want a reference rendered in a special way, you can ask your Java developers to implement or override this method.

4.1 Identifiers

All references consist of a leading $ character followed by a VTL Identifier. A VTL Identifier must start with an alphabetic character (a..z or A..Z). The rest of the characters are limited to the following types of characters:

  • alphabetic (a..z, A..Z)

  • numeric (0..9)

  • hyphen and underscore: - and _

Velocity identifiers are, just as Java variable names, case-sensitive.