【问题标题】:embed header and footer in all html page using google sitebricks @embed使用 google sitebricks @embed 在所有 html 页面中嵌入页眉和页脚
【发布时间】:2011-11-09 14:25:12
【问题描述】:

我正在使用 google guice 和 sitebricks 构建一个管理仪表板。您能告诉我如何在 html 页面中包含其他 html 文件吗?我正在寻找一个类似于 php 的 include("header.html") 函数的函数。我看到 sitebricks 有一个 @embed 注释,但找不到太多帮助

提前致谢

【问题讨论】:

    标签: java html embed guice sitebricks


    【解决方案1】:

    你有不同的可能性。

    使用嵌入

    @Embed 注解允许您声明可以嵌入到其他页面的页面片段。

    您可以在此处找到完整示例:http://code.google.com/p/google-sitebricks/wiki/EmbeddingBricks

    使用装饰

    另一种方法是使用页眉和页脚对通用页面进行贴花,并在页面的容器 div 上使用 @Decorated 注释。

    然后你必须将所有页面声明为@Decorated 并扩展通用页面。

    请在 sitebricks google 组中找到更多文档:https://groups.google.com/forum/#!searchin/google-sitebricks/decorated/google-sitebricks/CUOJM-CP9hM/ENe930RAuZwJ

    【讨论】:

      【解决方案2】:

      请查看 site-bricks 网站上的示例,如果它们有帮助,请告诉我们。 http://code.google.com/p/google-sitebricks/source/browse/trunk/acceptance-test/src/main/java/com/google/sitebricks/example/?r=146

      【讨论】:

      • 不是真的。我需要一个更具体的例子。我看到一个名为 embed.java 的示例,但我需要一个将一个 html 页面嵌入另一个页面的清晰示例。
      猜你喜欢
      • 2012-12-18
      • 2016-04-30
      • 2013-09-18
      • 2021-12-25
      • 2022-12-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多