【发布时间】:2015-07-28 22:45:54
【问题描述】:
我有以下几点:
<c:set var="myMode" value="#{component.parent.attributes['xyz-mode']}"/>
其中“xyz-mode”来自另一个复合组件... 当我使用这个打印它的值时:
<p:outputLabel value="#{myMode}" />
打印正确,假设值为 3 但是..在同一页面中,当我使用 c:if 或 c:when.. 它不会正确评估值:
<c:choose>
<c:when test="#{myMode == 3}">
<p:outputLabel value="mode is 3" />
</c:when>
<c:otherwise>
<p:outputLabel value="Otherwise" />
</c:otherwise>
</c:choose>
代码仅打印“否则”的情况..而不是“模式为 3” 请注意,从复合组件中检索到的“xyz-mode”的类型是 Integer.. 为什么会这样。。 现在已经 10 天了,我还没有找到答案:( .. 有人可以帮忙吗? 赞赏。
【问题讨论】:
标签: jsf jstl composite-component