未应用 scalate/scaml 布局
我已按照用户手册应用默认模板,例如在项目 src/main/webapp/WEB-INF/scalate/layouts/default.scaml 中,我有一个应该应用于所有诈骗文件的模板,但是当我点击了我的测试页面(在 src/main/webapp/WEB-INF/views/x/view.scaml 中),它仅呈现该页面中的内容。即使我在顶部放置一个显式布局属性,它仍然不会渲染,即
- attributes ("layout") = "/WEB-INF/scalate/layouts/default.scaml"
知道我可能做错了什么吗?
I've followed the user manual to apply a default template, e.g. in the projects src/main/webapp/WEB-INF/scalate/layouts/default.scaml I have a template that's supposed to get applied to all scaml files, but when I hit my test page (in src/main/webapp/WEB-INF/views/x/view.scaml) it only renders the content in that one page. Even if I put an explicit layout attribute at the top it still doesn't render, i.e.
- attributes ("layout") = "/WEB-INF/scalate/layouts/default.scaml"
Any idea on what I could be doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
深入研究 scalate 源代码(1.4.1),如果应应用布局,则 viewName 预计应以“layout:”为前缀,请参阅 https://github.com/scalate/scalate/blob/ master/scalate-spring-mvc/src/main/scala/org/fusesource/scalate/spring/view/ScalateViewResolver.scala。
这似乎是一个非常奇怪的决定,因为文档表明可以通过执行以下操作在每个视图的基础上禁用布局:
鉴于此,我不确定为什么默认情况下禁用布局,并且每个视图必须明确要求布局功能已启用。
Digging into the scalate source code (1.4.1) it appears that the viewName is expected to be prefixed with "layout:" if layouts should be applied, see https://github.com/scalate/scalate/blob/master/scalate-spring-mvc/src/main/scala/org/fusesource/scalate/spring/view/ScalateViewResolver.scala.
This seems like a very odd decision, since the docs indicate that layouts can be disabled on a per view basis by doing:
Given this I'm not sure why layouts are disabled by default and each view must explicitly ask for the layout feature to be enabled.