Chariot Training Classes

Training Courses

I run Chariot's training and mentoring services. We provide training in AngularJS, HTML5, Spring, Hibernate, Maven, Scala, and more.

Chariot Education Services


Chariot Emerging Tech

Learn about upcoming technologies and trends from my colleagues at Chariot Solutions.


Chariot Conferences



Setting up the IntelliJ Plugin for Groovy and Grails

The IntelliJ plugin is a great tool. However, one important thing to note is that it wants the source distribution of grails in the grails directory. Why? Because the GSP support requires the source code for the GSP tags.

Plugin Setup Process

In order to properly set up the Grails plugin, do the following:

  1. Download the grails source code zip file (which also contains the binary)

  2. Unzip the source code distribution

  3. Download the Groovy source and binary code distributions. Since the source release does not include a built binary, I had to download both the source and binary distributions and merge them together (building on my OS X machine failed). YMMV.

  4. Open IntelliJ Idea, go to the Preferences / Plugins page, and download JetGroovy and install it

  5. Restart Idea

  6. Open the Preferences / Plugins page again, and select Groovy

  7. Set the folder locations for Groovy and Grails to your new directories

There, that's it. Now, you can create Groovy and Grails projects, debug Groovy code, and use the Apple/Ctrl click trick to jump into Groovy or Grails source code.

GSP Tags

GSP tags are closures, so the plugin can't figure out attributes. That's ok, if you want to see more information, just CTRL or Apple click on the GSP tag name, and it will jump to the source code of the tag closure in the editor.


Grails and Spring WebFlow

Everyone has had to code an application at some point where they were forced into a particular set of navigational flows. There are a few ui-centric workflow packages out there, including Open Symphony's OSWorkflow, and Spring's WebFlow. Other developers at my shop have worked with WebFlow and were pleased with its' features. But did you know that Grails embeds WebFlow and makes it available within its' controllers automatically?

WebFlow Basics

For a thorough introduction to Spring Webflow, I suggest visiting the SpringSource site. However, in general, webflows can be broken up into distinct components:

  • State - This is a 'definable moment' within the webflow, such as a View State, where the application is waiting on user input.

  • Transition - An event, often fired by a user taking an action, that moves the webflow from one state to another.
  • Action - Code that can be performed within a transition, or on the start or ending of a given State

  • View - A (GSP) page that is rendered during a 'view state'.
  • Flow Scope - A semi-session-like container that lives for the life of the webflow. Data captured from one view to the next

Without too much more ceremony, I can simply say that although Spring WebFlows are a great feature, and take a lot of pain out of implementing flow-based application logic, they are made even easier by Grails.

A Grails WebFlow

Here is a simple webflow that represents a fragment of a voting application. Call it KrimpleVote (or HangingChad, the system)... (I have since lost the image itself...) To build a webflow in Grails, simply create a closure ending in Flow, and embed the states, transitions and actions as inner closures. It's easier to read than it is to describe:

def registrationFlow = {

showDisclaimer {
on("continue").to "lookupVoter"

lookupVoter {
on("selfRegister").to "selfRegister"
on("find") {
if (!params.ssn) {
return error()

def voter = Voter.findBySsn(params.ssn)
if (voter == null || voter.ssn == null) {
return error()
} else {
flow.voter = voter
}.to "showRegistration"
on("return").to "lookupVoter"

selfRegister {
on("continue") {
Voter v = new Voter(params)
if (!v.validate()) return error()
flow.voter = v
}.to "chooseParty"

View states are closures that do not automatically transition to another state. Take a look at the showDisclaimer closure as it's a view state. It waits for the 'continue' event to be sent as a transition from the user. You do that by submitting a form to the same closure (registration) and embedding a submitButton within the form with the name of the transition:

fragment of showDisclaimer.gsp

Note: You have to put the GSPs in a subdirectory named registration under the controller's views as it puts all webflow views in a subdirectory by flow name (without Flow). Also, the pages are pretty straightforward as well. Another nice thing is that it automatically handles the flow continuation key for you.

I've been (slowly) getting around to putting that Voter application together as a sample. Once I do, I will post it for download. Until then, I'll post some snippets as I learn more.

For more Flow goodness, check out the grails documentation page on it.


New Chariot Tech Cast episode : Rails 101

For those who don't know me, I also host a podcast for my employer, Chariot Solutions. The tech cast is featuring presentations from last week's ETE conference in Philadelphia. The new episode is entitled "Rails 101" and features Aaron Mulder, who gives a tutorial on Rails 2.0. It's a very good presentation. The RSS feed is located at and the PDF file of the presentation is here.


Rimple on Tech now iPhone Friendly

I've just installed the iwphone theme and plugin, making it much easier to read the blog on an iPhone. Enjoy.


Groovy Samples Episode #2 Available

I've just uploaded episode #2 of the Groovy Examples screencast. In this show I discuss lists and maps in Groovy, and how much easier they are to use than their Java equivalents. Click on the image to view the presentation (QuickTime H.264)

To subscribe to the podcast, browse to, or to download the movie directly, click on the image below.