Reputation: 35928
I just upgraded to grails 2.2.4 from 2.1.2. Everything works fine on my local but, however, when I packaged the WAR onto the test environment I am seeing a weird error. On a form that uses a template I am getting an error:
template not found for name [form] and path [/base/_form.gsp].
However, this template (using from create.gsp) is not under the base folder. It is under a folder called color (under views), which is where both create.gsp
and _form.gsp
reside
This is the tag I'm using from create.gsp:
<g:render template="form" bean="${mybean}"/>
It seems that grails is assume that the template lives in base
but it really lives in color
.
Upvotes: 2
Views: 4005
Reputation: 11643
You are getting this error,
template not found for name [form] and path [/base/_form.gsp]
because Grails is looking for _form.gsp
in a path relative by convention to a folder with the same name as the controller that is rendering the parent gsp. This will always be the case if you don't supply an absolute path (starting from views
folder) in the render tag.
Where is your _form.gsp page? Here are some example paths
grails-app/views/_form.gsp
-> <g:render template="/form" ..
grails-app/views/base/_form.gsp
-> <g:render template="/base/form" ...
or -> <g:render template="form" .. //if calling from baseController
So if _form.gsp lives in color and color is at grails-app/views/color, you would need the following path in your render tag:
<g:render template="/color/form"
Upvotes: 6