0

pageProperty在我的视图中设置了一个content标签,但是,Grails 1.3.6ifPageProperty没有检测到我的侧边栏pageProperty。有什么想法吗?

布局.gsp

<g:ifPageProperty name="page.sidebar">
  <aside id="sidebar">
    <g:pageProperty name="page.sidebar" />
  </aside>
</g:ifPageProperty>

视图.gsp

<html>
<head>
<title>My Account Title</title>
</head>
<body>
  <content tag="sidebar">
    <h4>Sidebar</h4>
    <p>Hola. This is a sidebar test!</p>
  </content>
  <h1>Content Heading</h1>
</body>
</html>

PS。如果您想知道我在哪里设置布局,它是在控制器中设置的。

4

2 回答 2

1

一位同事搜索了 Grails 错误列表,发现必须关闭 Sitemesh 的预处理。

// enable Sitemesh preprocessing of GSP pages
grails.views.gsp.sitemesh.preprocess = false
于 2011-02-09T00:33:49.110 回答
0

你能试试这个作为解决这个问题的方法吗:

<g:if test="${g.pageProperty(name:'page.sidebar')?.length()}">
  <aside id="sidebar">
    <g:pageProperty name="page.sidebar" />
  </aside>
</g:if>
于 2011-02-09T22:54:14.990 回答