Does the Grails undocumented method ifPageProperty actually work?
I am setting a pageProperty
in my view with a content
tag, however, Grails 1.3.6 ifPageProperty
is not detecting my sidebar pageProperty
. Any thoughts?
layout.gsp
开发者_C百科<g:ifPageProperty name="page.sidebar">
<aside id="sidebar">
<g:pageProperty name="page.sidebar" />
</aside>
</g:ifPageProperty>
view.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. If you're wondering where I am setting my layout, it's being set in the controller.
A coworker scoured the Grails buglist and found out that Sitemesh's preprocess must be turned off.
// enable Sitemesh preprocessing of GSP pages
grails.views.gsp.sitemesh.preprocess = false
Could you try this as a workaround for the problem:
<g:if test="${g.pageProperty(name:'page.sidebar')?.length()}">
<aside id="sidebar">
<g:pageProperty name="page.sidebar" />
</aside>
</g:if>
精彩评论