【问题标题】:Sitemesh 2.4.2: How to use decorators other than body decoratorSitemesh 2.4.2:如何使用主体装饰器以外的装饰器
【发布时间】:2014-02-14 14:22:43
【问题描述】:

我正在使用struts2-archetype-starter maven 模板来创建 Struts2 webapp。虽然,我以前使用过 Struts2,但我是 Sitemesh 的新手。我的decorator 文件夹中有一个adminTemplate.jsp,其中包含一个

<decorator:body />

标签。我们知道,body 并不是我们唯一想要自定义的东西,我需要在我的页面中添加一些自定义的脚本<decorator:body /> 位于页脚上方(不是很好的脚本放置位置)。

我也尝试参考sitemesh提供的文档,这里:-

http://wiki.sitemesh.org/display/sitemesh/Passing+Additional+Elements+to+the+Decorator

但是,不幸的是,该页面根本没有任何文字。

谁能告诉我如何达到同样的效果?如果有人也可以留下一些好的文档的指针,那将非常有帮助。

【问题讨论】:

    标签: jsp struts2 sitemesh


    【解决方案1】:

    您可以在 adminTemplate.jsp 中插入 head 占位符

    <head>
      <title>
        <decorator:title/>
      </title>
      ...
      ...
      <decorator:head/>
    </head>
    

    然后在您的页面中自定义脚本

    <head>
      <title>
        page1
      </title>
      <script>
        ....
      </script>
    </head>
    

    【讨论】:

      猜你喜欢
      • 2011-04-12
      • 2011-12-24
      • 2022-08-15
      • 2013-03-01
      • 2021-07-19
      • 1970-01-01
      • 2011-05-21
      • 1970-01-01
      • 2018-06-08
      相关资源
      最近更新 更多