Quick Start
Overview
TemplAT is a general purpose text file template engine. It allows a Java developer to construct templates of text files (HTML, SQL, etc.) with a simple programming language, and use the TemplAT API to render text files from the templates.
Simple Example
Once you have downloaded the templat.jar file and put it into your classpath,
you can make a simple example program to demonstrate how TemplAT works.
For example, create a text file called displayBooks.tat; this will be our template.
The highlighted regions represent tags that will be parsed by the Templat class.
Tags are surrounded by at-signs (@).
The template tag defines this file as a template, and specifies its parameters.
The loop tag starts a loop block, and identifies the loop counter variable and the number of times the loop block will be expanded.
The expressions in the next line will be parsed by the Templat class, and the returned values expanded into the resulting text.
The end loop tag ends the loop block.
Then create a Java program (JDK >= 5.0) that renders the template (given a list of books), and prints the results.
Compiling and running the program produces the following output: