问题描述
我正在将一个带有内置facelets的项目从JSF1.2/Facelets1.1升级到JSF2.1.以下内容不再有效,我也不知道为什么.显然两个ui:fragments都评估为true,并且呈现链接版本和纯文本版本:
I am upgrading a project from JSF1.2/Facelets1.1 to JSF2.1 with built in facelets. The following no longer works and I don't know why. Both ui:fragments apparently evaluate to true, and both the link version and the plain text version are rendered:
<ui:fragment rendered="#{rootcauseid ne rc.id}">
<a href="#{request.contextPath}/viewrootcause.jsf?rootcausenum=#{rc.id}">Root Cause #{rcRowCounter + 1}</a>
</ui:fragment>
<ui:fragment rendered="#{rootcauseid eq rc.id}">
<h:outputText value="Root Cause #{rcRowCounter + 1}"/>
</ui:fragment>
以下方法确实有效,所以我有一个有效的解决方法.
The following does work, so I have a valid workaround.
<h:panelGroup rendered="#{rootcauseid ne rc.id}">
<a href="#{request.contextPath}/viewrootcause.jsf?rootcausenum=#{rc.id}">Root Cause #{rcRowCounter + 1}</a>
</h:panelGroup>
<h:outputText value="Root Cause #{rcRowCounter + 1}"
rendered="#{rootcauseid eq rc.id}"/>
但是为什么ui:fragment版本不起作用? Facelets和JSF有什么变化会有所作为? "ui:fragment rendering ='...'"不再是有效的成语吗?
But why doesn't the ui:fragment version work? What has changed about Facelets and JSF that would make a difference? Is "ui:fragment rendered='...'" no longer a valid idiom?
推荐答案
根据规范,ui:fragment仅具有id和binding属性.
According to the specification, ui:fragment has only id and binding attributes.
这篇关于将Facelets升级到JSF 2后,ui:fragment呈现的属性不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!