facelets ui:fragment忽略渲染属性

Tin*_*ard 3 jsf facelets primefaces jsf-2

我对这段代码有一种非常奇怪的行为:

<ui:fragment rendered="#{price.guestIdTrue}">
<b>PRICE_GUEST_ID_TRUE : #{price.guestIdTrue}</b>
    <h:outputText>#{Global.guestTypeMap[price.guestId]}&#160;#{price.guestIndex}</h:outputText>
</ui:fragment>
Run Code Online (Sandbox Code Playgroud)

即使渲染条件为假,也是如此

PRICE_GUEST_ID_TRUE:false 1

1是#{price.guestIndex}

ui名称空间已正确定义,并且适用于其他facelets.

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:t="http://myfaces.apache.org/tomahawk">
Run Code Online (Sandbox Code Playgroud)

什么发生的想法.

提前致谢.

Bal*_*usC 6

您似乎<ui:fragment>在迭代标记/组件中使用,其中#{price}实际上是当前迭代的变量,例如JSTL <c:forEach>标记,或者使用早期版本的Mojarra时的JSF <h:dataTable><ui:repeat>组件.在这种情况下,#{price}不是在EL范围可在它被评估的点.

您需要<h:panelGroup rendered>代替或将Mojarra版本升级到最新版本.