我刚从动作书中的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
答案 0 :(得分:7)
....必须是时候让我把它称为一个晚上..本书说要编码以下内容:
class QuoteController {
def index = {}
def home = {
render "<h1>Real programmers do not each Quiche</h1>"
}
}
而不是render =“...”