CHAPTER 9Miscellaneous Recipes

In this chapter, I present miscellaneous recipes from different topics. Templating, working with XML, working with files, using regular expressions, using Groovy from the command line, downloading files, writing configuration files in Groovy, and using Groovy to run external processes are some of the examples I present in this chapter.

9-1. How Do I Use Groovy Templates to Generate Dynamic and Reusable Content?

In Recipe 3-1, I showed you how to use GStrings to generate dynamic content that can be useful in templating scenarios. Groovy also has a powerful dedicated template framework with several template engines that can be used to create templates with embedded JSP-like scriptlets and variables (JSP stands for ...

Get Groovy and Grails Recipes now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.