Sitemesh 布局不适用于 Grails 中的 g.include 标记
我正在渲染一个结合了 g.include 调用和 sitemesh 布局的视图。 视图将是这样的: myview.gsp
<html>
<head>
<meta name="layout" content="checkout" />
</head>
<body>...
在正文中有一个调用:
g.include(controller:"mycontroller", action:"myaction")
问题是 sitemesh 布局从不应用。如果我删除包含调用,一切都会正常工作。
我还没有在网站上找到对此问题的参考。 有没有人找到此问题的解决方法或提示,将不胜感激!
谢谢
-巴勃罗·杜兰蒂
I am rendering a view that combines a g.include invocation and a sitemesh layout.
The view would be something like this:
myview.gsp
<html>
<head>
<meta name="layout" content="checkout" />
</head>
<body>...
within the body there is an invocation to:
g.include(controller:"mycontroller", action:"myaction")
The problem is the sitemesh layout is never applied. If I remove the include invocation things work just fine.
I haven't found references to this problem in the site yet.
Has anyone found a workaround to this issue or a tip, will be much appreciated!
Thanks
-Pablo Duranti
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的索引文件就像底层:
它适用于 Grails 1.0、1.2.2 和现在的 1.3.7。
在您尝试包含的每个操作中,您无法渲染视图,而是渲染模板。模板文件只能包含 HTML 片段,不能包含头部、布局元等。
在我的缓存控制器中
模板文件:
My index file is like underlying:
It works in Grails 1.0, 1.2.2 and now 1.3.7.
In each of actions you try to include, you can not render the view, but render the template instead. The template file can ONLY has fragments of HTML, it can NOT include the head, meta for layout, etc.
In my cache controller
The template file: