【问题标题】:Why there is no output?为什么没有输出?
【发布时间】:2015-04-05 18:55:50
【问题描述】:

如果我删除<c:if> 标签,它将显示来自findByClass 的所有项目。 <c:if>如何使用或者有其他方式显示eventId

   <ui:repeat value="#{eventsController.findByClass}" var="item">
                            <c:if test="${item.eventId==10}">
                                <h:outputText value="${item.eventName}"></h:outputText>
                                <p></p>
                        </c:if>
                        </ui:repeat>

【问题讨论】:

    标签: java jsf-2 jstl


    【解决方案1】:

    试试这个

    <ui:repeat value="#{eventsController.findByClass}" var="item">
        <h:outputText value="#{item.eventName}" rendered="#{item.eventId==10}"/>
    </ui:repeat>
    

    Facelets (ui:repeat) 和 JSTL (c:if) 在不同的阶段进行评估,这导致 c:if 中的条件始终返回 false。

    【讨论】:

    • 谢谢!有用!!! (ps.我不能给你投票,因为我没有足够的声誉
    猜你喜欢
    • 2019-12-21
    • 1970-01-01
    • 2014-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-17
    相关资源
    最近更新 更多