【发布时间】:2015-08-06 10:08:09
【问题描述】:
我开始使用 Grails (3.x) 框架,但在尝试将域内容呈现到视图时遇到此错误:
Error 500: Internal Server Error
URI /hello/index
Class javax.servlet.ServletException
Message: Could not resolve view with name 'index' in servlet with name 'grailsDispatcherServlet'
HelloController.groovy:
package helloworld
class HelloController {
def index() {
def Person persona1 = new Person(firstName: "someone", lastName: "stuck", age: 21)
[persona:persona1]
}
}
Person.groovy:
package helloworld
class Person {
String firstName
String lastName
int age
}
【问题讨论】:
-
你应该能够运行类似
grails generate-views ..的东西来生成视图。