【发布时间】:2015-03-23 20:57:36
【问题描述】:
我是 Grails 的新手,我正在尝试通过控制器动态填充模板导航栏。我真的很接近解决这个问题,但最近似乎碰壁了。
当我点击该控制器的链接时,我目前正在获取导航以填充仅。在其他任何地方,导航只会填充链接的项目符号。我可能没有在我的模板中正确引用控制器,但还没有找到任何好的示例。
使用 Grails 2.3.3 控制器是动态的。
这是我的导航模板的代码
<body>
<!-- Links to the committees go here -->
<div class="leftMenu">
<!-- template of hospitals and there committees goes here -->
<div>
<g:render template="/hospital/committeeTemp" />
</div>
<tr valign="top">
<td>
<a href="index.jsp?nav=main&hosp=<%=hospGiven %>" target="_top">
<img src="/Trustees/static/images/img/navigate.events.gif" border="0">
</a>
</td>
</tr>
<tr valign="top">
<td>
<a href="index.jsp?nav=main&hosp=<%=hospGiven %>" target="_top">
<img src="/Trustees/static/images/img/navigate.news.gif" border="0">
</a>
</td>
</tr>
<tr valign="top">
<td>
<a href="index.jsp?nav=main&hosp=<%=hospGiven %>" target="_top">
<img src="/Trustees/static/images/img/navigate.help.gif" border="0">
</a>
</td>
</tr>
<%-- </table>--%>
</div>
</body>
我正在使用嵌套循环来填充导航栏。该代码可以在这里找到Grails navigation links nested loop
【问题讨论】:
-
-
我已经用我的代码更新了我的问题。
-
我想我的问题表述不正确。我想要做的是在整个网站范围内动态填充导航栏,以便我可以使用这些链接,如主要内容的搜索过滤器。我创建了一个模板来为导航链接生成正确的格式,并在 main.gsp 页面上呈现模板。然而,导航栏仅在我查看该控制器时才会填充。
标签: grails controller