我有一个动态表单元素,您可以添加和删除文本框。该元素有一个标题。当没有文本框时,我不希望呈现标题。我正在尝试使用呈现的属性显示和隐藏此标题,但它无法正常工作。我的代码如下:
<!-- Dynamic form element with add and remove capabilities (see above) -->
<h:outputLabel value="Base Maps: " for="baseMaps" />
<h:panelGrid id="itemPanel">
<h:dataTable binding="#{itemTable}" value="#{account.item}" id="item">
<h:column>
<f:facet name="header" rendered="#{account.isNotEmpty(account.item)}">Item Name</f:facet>
<h:inputText value="#{account.item[itemTable.rowIndex]}" />
</h:column>
<h:column>
<h:commandLink value="Delete" action="#{account.remove(itemTable.rowIndex,account.item)}"
styleClass="form-delete">
<f:ajax execute="@form" render="@form" />
</h:commandLink>
</h:column>
</h:dataTable>
<h:commandButton value="add" action="#{account.add(account.item)}">
<f:ajax execute="@form" render="@form" />
</h:commandButton>
</h:panelGrid>