- By: Christopher M. Judd , Joseph Faisal Nusairat , Jim Shingler
- ISBN10: 1-4302-1045-1
- ISBN13: 978-1-4302-1045-0
- 440 pp.
- Published Jun 2008
- Price: $42.99
- eBook Price: $30.09
Submit Book Errata
If you think that you've found an error in our book, please let us know.
Past Errata Submission
| Errata | Author's Reply |
|---|---|
| Chapter 6, page 199, listing 6-30: the description of the Todo.findAllByPriorityOrStatus("2","4") should read 'in the second, you're separating the retrieval with an Or, so that if a record has a PRIORITY of "2" or a status of "4".' | The submitter provided a solution, and yes that is correct that it should be a priority of 2 or a status of 4. Thank you. And i have also updated http://www.beginninggroovyandgrails.com/ with the errata provided |
| page 181. tablePerHierachy true -> should be false. The default is true it will create only one table with the differentiator field. grails 1.0.3. |
Your right. It should be false. |
| Page 2 - Under Groovy Installation. It maybe unclear but there are platform specific installers for Windows, Ubuntu and Debian. | . |
| Chapter 2, Listing 2-35, page 41. This line doesn't work: list.collect { println it.printFullName() } because you are printing the result of calling printFullName(), which itself already calls println, the result of which is null. Instead, you should have in the User class: def fullName() { "$firstName $lastName" } and list.each { println it.fullName() } |
You are correct and thanks for the solution. |
| Chapter 5 Page 123 Listing 5-11 The form action is not correctly defined. By default the action will be the value of the actionSubmit button but in this case we want the button text to read Login and the action to be handleLogin. Changing the actionSubmit value to handleLogin works but a better solution is to add action = "handleLogin" to the actionSubmit tag. 26 <span class="button"><g:actionSubmit value="Login" action="handleLogin" /> |
duplicate |
| Chapter 5 Page 149 Code Listing 5-30 doesn't work properly. if (session.user.id != params.id) { should be if (session.user.id != params.id.toInteger()) { |
duplicate |
| p266: 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> |
Your correct. |
| on chapter 2 the java code in listing 2-7 (SayHello.java) is wrong. void main (String [] args) rather than void main (String args[]) |
Actually depending on the versions of javac either one will work. But you bring up a great point your suggest is the preferred method and will work more universally. |
| Around page 100 - 129 The log in doesn't work. It seems like the method handleLogin doesn't really receieve anything from the form at all. Also, if you test it by using test-app, the testHandleInvalidUser will fail with this error "Cannot send redirect - response is already committed" |
* Page 123 - Due to a bug fix in Grails 1.0.3 the actionSubmit on line 26 of Listing 5-11 should be the following: <span class="button"><g:actionSubmit value="Login" action="handleLogin"/> * Page 125 - Due to a bug fix in Grails 1.0.3 the handleLogin action in Listing 5-13 does not work any longer. The new implementation is: 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') } } |
| Hello, page 149 Listing 5-30. The edit Action with User Check def edit = { if (session.user.id != params.id) { flash.message = "You can only edit yourself" redirect(action:list) return } if section - id in session is integer, id in params is string, you cant compare integer with string..one of if params should be casting to second parameter type.. same mistake following in next pages Best regards. |
duplicate |
| I bought this book online and was wondering if there is any sample code for this book yet? | Yes. The sample code can be found http://www.apress.com/book/downloadfile/4089 or the most up to date version which includes fixes for Grails 1.0.3 can be found at http://www.beginninggroovyandgrails.com/site/content/source. |
| Chapter 5, page 156 "Additionally, you should apply the enhancement you made to the category controller and view to the to-do controller and views." The Todo functionality also needs restriction to ensure that a user's Todos are only classified using the same user's Categories. The population of the Category dropdown on the Todo create and edit screens needs modification. |
Your correct, the list of categories should be filtered for that user. |
| Chapter 5, page 154, listing 5-35 (Restricting the list Action) Putting [ categoryList: Category.findAllByUser(user, params) ] in the controller doesn't address the fact that the view still contains <div class="paginateButtons"> <g:paginate total="${Category.count()}" /> </div> I suggest returning this map from the Action: [ categoryList: Category.findAllByUser(user, params), categoryCount: Category.countByUser(user) ] and then using <g:paginate total="${categoryCount}" /> in the view. The same will apply to the Todo list. |
Good suggestion. |
| Chapter 5, page 149, listing 5-30: Your check for whether or not the User being edited is the same as the logged-in user: if (session.user.id != params.id) { is trying to compare a Long with a String. Replacing session.user.id with "${session.user.id}" works. (Feel free to choose a more elegant solution!) |
There have been several reports of issues 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) { Notice the ? Null safe dereference and casting to String for comparison. |
