Feras Odeh
Feras Odeh

Reputation: 9296

Grails: Render template returns {}

I'm trying to render template from controller but I got {}. If I tried to render a text or HTML directly I got it rendered. I use the following code to render template:

render(template:'/visit/registration')

I'm not sure if package name could cause the problem. My controller is inside PackageName.Visit package and my views is inside visit folder directly inside view folder. I'm using Grails 2.2

Upvotes: 0

Views: 316

Answers (1)

Gregg
Gregg

Reputation: 35864

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.

Upvotes: 1

Related Questions