我想将我的layouts / main.gsp布局应用于用户/登录页面。
我的main.gsp引用了其他CSS并引用了模板:
</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>
但是,当我运行该应用程序并登录时,单击它说找不到模板路径。我了解到,由于登录位于“用户”文件夹中,因此无法搜索路径。
问题是:如何将布局应用于我的登录页面。
最佳答案
您需要指定模板的绝对路径:
<g:render template = "/templates/headerTop" contextPath = "/"></g:render>
关于grails - 如何将布局和模板应用于其他 Controller 文件夹?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23334996/