渲染方法在Grails中不起作用

时间:2009-08-16 05:28:34

标签: grails

我刚从动作书中的grails开始。

通过grails create-app

制作新应用

然后该书说在QuoteController.groovy

中有以下代码
class QuoteController {
    def index = {}
    def home = {
        render= "<h1>Real programmers do not each Quiche</h1>"
    }
}

现在,当我浏览页面http://localhost:8080/qotd/quote/home时,出现以下错误:

Error 500: groovy.lang.MissingPropertyException: No such property: render for class: QuoteController
Servlet: grails
URI: /qotd/grails/quote/home.dispatch
Exception Message: No such property: render for class: QuoteController
Caused by: groovy.lang.MissingPropertyException: No such property: render for class: QuoteController
Class: Unknown
At Line: [-1]
Code Snippet:

好像'render'不是有效的属性?我有什么想法可能做错了吗? 我正在使用Grails 1.1.1

1 个答案:

答案 0 :(得分:7)

....必须是时候让我把它称为一个晚上..本书说要编码以下内容:

class QuoteController {
    def index = {}
    def home = {
        render "<h1>Real programmers do not each Quiche</h1>"
    }
}

而不是render =“...”