Utsav Popli
Utsav Popli

Reputation: 79

How to apply layout and templates to other controller folder?

I want to apply my layouts/main.gsp layout to the user/login page. my main.gsp has reference to other css and refernces to the templates :

</head>

<body>

<g:render template = "templates/headerTop" contextPath = "/"></g:render>

<g:render template = "templates/menuHeader" contextPath = "/"></g:render>
<g:layoutBody/>
<g:render template="templates/footer" contextPath = "/"></g:render>

</body>

But when i run the application and go to login click it says it can not find the template path. I understand that since login is in 'user' folder so it is not able to search the path. Question is : how to apply layout to my login page.

Upvotes: 0

Views: 413

Answers (1)

lukelazarovic
lukelazarovic

Reputation: 1502

You need to specify absolute path to your templates:

   <g:render template = "/templates/headerTop" contextPath = "/"></g:render>

Upvotes: 1

Related Questions