ui:fragment rendered attribute not working after upgrading Facelets to JSF 2

守給你的承諾、 提交于 2019-12-24 09:58:54

问题


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}"/>

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?


回答1:


According to the specification, ui:fragment has only id and binding attributes.



来源:https://stackoverflow.com/questions/7775659/uifragment-rendered-attribute-not-working-after-upgrading-facelets-to-jsf-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!