我正在尝试从控制器渲染模板,但我得到了 {}。如果我尝试直接渲染文本或 HTML,我会渲染它。我使用以下代码来呈现模板:
render(template:'/visit/registration')
我不确定包名称是否会导致问题。我的控制器在 PackageName.Visit 包内,我的视图直接在视图文件夹内的访问文件夹内。我正在使用 Grails 2.2
If you're controller is VisitController, then you're render would look like
render template: 'registration'
Assuming you have grails-app/views/visit/_registration.gsp
. If it is not really a template (_ denotes template), then you're render would be:
render view: 'registration'
If you're action is called registration, you don't need to explicitly call render.