There are several things you should change here.
One, the preferred way of defining controller actions is as methods instead of closures.
class HelloController {
def userList() {
return users
}
}
Two, your view should not be calling controller methods. Your controller action should return the model necessary for your view to render.
class HelloController {
def list() {
return [userList: users]
}
}
Then in your view, which would be hello/list.gsp
, you can access userList
.