CHAPTER 21 TEMPLATE ENGINES

The mail merge features found in a word processor are used to merge form letters with names and addresses from a mailing list. A form letter consists of static text, such as the body of the letter, and place-holders for those parts of the letter that are to be replaced. Typically, this might include the name and address of the recipient. The data source includes the values for the place-holders for each individual to receive the letter. Such merge facilities can greatly reduce the burden on the user, especially when the amount of data is large and comprises various elements.

Groovy’s template engine operates like a mail merge but is much more general. Essentially, there is no restriction on the nature of the form ...

Get Groovy Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.