Chapter 5 Advanced Groovy Programming

Overview

This chapter describes some Groovy modules that help in day-to-day development tasks. The topics covered include:

  • GroovySQL – access databases in a Groovy manner (closures, GStrings, etc.)
  • Groovlets – Groovy for Servlet programming
  • Groovy Templates – Template processing in Groovy
  • Groovy Markup – manipulate XML and other tree-like structures with Groovy
  • Groovy and Swing – How to use Groovy for rapid creation of user interfaces

Code Samples

Download

Notes

  • To build Groovlet section example, run:
    ant -f ch8-build.xml

    It will create groovlet.war file in the current directory and try to deploy it to the Jetty container if it is available.

    This example is configured to be built using Groovy 1.0-JSR-O6 and MySQL JDBC connector 3.0.17. If you want to run examples in different environments, you will have to change configuration in ch5-build.properties file.

Corrections

The result of Listing 5.29 includes <html:hmtl> instead of <html:html> (thanks to Jeanne Boyarsky for spotting)