我在使用 JSP 时遇到问题<c:if test="">。 <c:if test="true">并按<c:if test="false">预期工作。但以下代码段没有:
<p:dataTable value="#{orderMB.allAdTypes}" var="ad">
<c:if test="ad.isNotFullPage()">
<p:column headerText="Type">
<h:outputText value="#{ad.typeToString}" />
</p:column>
</c:if>
<p:column headerText="Name">
<h:outputText value="#{ad.name}" />
</p:column>
</p:dataTable>
我只看到一列;ad.isNotFullPage()永远不会被调用。我已经尝试了test="#{ad.isNotFullPage()},test="${ad.isNotFullPage()}"的所有组合test="#{ad.isNotFullPage}(最后希望ad.getIsNotFullPage()被调用。)
orderMB是一个@ManagedBean @ViewScoped。 orderMB.getAllAdTypes()返回List<AdType>。 AdType是@Entity @Table(name = "ad_type")。
这是在 Glassfish 3.1、JDK 1.7 上运行的。