【发布时间】:2013-03-26 19:59:33
【问题描述】:
Grails GSP 中有没有办法替换以下内容
<tmpl:/templates/header />
<!-- tmpl namespace call is equivalent to <g:render template="/templates/header" /> -->
<!-- definition of inner content -->
<tmpl:/templates/footer />
使用外部模板?本质上是一种导入包装外模板的方法,
<outertemplate:templatename>
<!-- header will be rendered from outer template -->
<!-- definition of inner content -->
<!-- footer will be rendered from outer template -->
</outertemplate:templatename>
外部模板的定义类似于
<!-- definition of header content -->
<!-- placeholder or attr for inner content -->
<!-- definition of footer content -->
将包装内容封装在一个模板而不是两个模板中。 IIRC 在 JSF 下有一种方法可以做到这一点,但我在 GSP 下找不到等价物。
【问题讨论】:
-
我不确定你在问什么。模板可以渲染模板。
-
你能详细说明你的问题吗?
-
@James McMahon,您的问题对于您尝试进行的明显重构来说太具体了。我们首先需要知道 tmpl tagLib 做了什么。
-
我试图让问题更清楚,很抱歉造成混乱。
标签: grails grails-2.0 gsp