grails question (sample 1 of Grails To Action book) problem with Controller and Service -


I'm doing Grails for action one for the Action Sample until I started working with the services By then everyone was just fine when I run the app. I have the following error:

  groovy.lang.MissingPropertyException: For any such property: quoteService class: qotd.QuoteController $ _closure3.do qotd on call .QuoteController (QuoteController.groovy: 14) qotd.QuoteController $ _closure3.doCall (QuoteController.groovy) at java.lang.Thread.run (Thread.java:619)  

Here's my Groovie quoteService class, which

  package Qotd class quoteService {boolean behavior = getRandomQuote def (false) {error is all error within the definition of quote.list (GetStaticQuote (error: error unable to resolve Groovy class quote)) if def delivers randomQuote = (allQuotes .size ()> 0) {def randomIdx = new random (.) NextInt (allQuotes.size ()) randomQuote = allQuotes [randomIdx]} else {randomQuote = getStaticQuote ()} return randomQuote} def getStaticQuote () {new Quote (Author: "Anonymous", Content: "Real Programmers do not eat quacks")}}   

Eclipse I get a definition of getStaticQuote Show flagged flag:

  Error: Groove: Unable to solve class  

Any clues?

Controller groovie class

  package qotd class quotecontroller {def index = {redirect (action: random)} def home = {render "> lieutenant; h 1> Real Programmers do not touch each other! & Lt; / h1 & gt; } Def Random = {def randomQuote = quoteService.getRandomQuote () [citation: random question]} def ajaxRandom = {def randomQuote = quoteService.getRandomQuote () "& lt; q> $ {randomquote.content}  

quote class:

  package qotd class quote {string content string author date created = new date (static) constraints = {Authors (empty: false) content (maximum size: 1000, empty: wrong)}}  

Any advice I'm sampling using STS?

Regards,

Francisco

Def quoteService

at the top of your controller and inject it into the controller automatically


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -