Changes


String args[create ] may not work with all groovyc compilers but it does work with javac. If you run into an issue try String[create ] args. {;} is appropriate for the Windows platform. If you are on Linux, Unix or Mac OSX, you will need to replace {;} with {:}. Line 03 could also be written like the following without java.util
return {println "${initialDate} - ${new Date()} : Elapsed time
There should not be an S on that line.
list = set as List
03 assert "abcabc" ==~ /abc/ // Fails - not an exact match
list.collect{it.printlnFullName()}
It should be,
<div id="topbar">
<g:render template="/common/topbar" />
</div>
<g:form… instead of <form.. and </g:form> instead of </form>
<span class="button"><g:actionSubmit value="Login" action="handleLogin"/>
def handleLogin = {
  def user = User.findByUserName(params.userName)
  if (!user) {
    flash.message = "User not found for userName: ${params.userName}"
    redirect(action:'login')
    return
  } else {
    session.user = user
    redirect(controller:'todo')
  }
}
def handleLogin = {
        def user = User.findByUserName(params.userName)
        if (!user) {
            flash.message = "User not found for userName: ${params.userName}"
            redirect(controller: 'user', action:'login')
            return
        } else {
            session.user = user
            redirect(controller:'todo')
        }
    }

def logout = { if(session.user) { session.user = null redirect(controller: 'user', action:'login') } }

<div id="menu">
  <nobr>
    <g:if test="${session.user}">
      <b>${session.user?.firstName}&nbsp;${session.user?.lastName}</b> |
      <g:link controller="user" action="logout"><g:message code="topbar.logout" /></g:link>
    </g:if>
    <g:else>
      <g:link controller="user" action="login"><g:message code="topbar.login" /></g:link>
    </g:else>
  </nobr>
</div>
{/code}
* page 149 Listing 5-30
There have been several reports of issue with the if statement. As written, it assumes
that the user is logged in.  There is also a type conversion issue in comparing session.user.id (Long) to params.id (String).
You may want to update the code as follows:
if (session.user?.id as String != params.id) { {code}

Notice the ? Null safe dereference and casting to String for comparison.

id composite:[create 'name','dueDate'] dueDate (should be file or associatedFile) and asociatedFile (should be associatedFile)

<tr class='prop'> <td valign='top' class='name'><label for='dueDate'>File:</label></td>

<td valign='top'

class='value ${hasErrors(bean:todo,field:'asociatedFile','errors')}'> <input type="file" name="asociatedFile" /> </td> </tr>

"/$rest/$domain/$id?"{
And the second line of code on page 302 in listing 301 should be:
domainClassName = capitalize(params.domain)

Using Examples with Eclipse

Unfortunately, the Eclipse Groovy plug-in is not by default prepared to run Grails applications using the Grails generated launcher. Here are the things you need to do to configure Eclipse and the examples to work in Eclipse.

  1. Set GRAILS_HOME Classpath Variable to a local Grails 1.0.3 intallation.
  2. In the project's Groovy Project Properties check the Disable Groovy Compiler Generating Class Files.
  3. Configure the project's JRE to be a full JDK including the tools.jar.

See http://grails.org/Eclipse+IDE+Integration for more details.

Submitting Errata

If you find any errors send us an email at - authors@beginninggroovyandgrails.com