我与JSF 2.2.9的工作,我有以下DataTable,并将按钮:
<h:commandButton id="commandButtonRemoverSelected"
actionListener="#{managedBeanName.removeSelected()}"
class="btn btn-primary" value="Sim">
</h:commandButton>
<h:dataTable var="bean" value="#{managedBeanName.beans}" styleClass="table table-hover"
binding="#{managedBeanName.dataTable}">
<h:column headerClass="smallColumn">
<f:facet name="header">
<h:selectBooleanCheckbox valueChangeListener="#{managedBeanName.selectAll}">
<f:ajax execute="@form" render="@all" />
</h:selectBooleanCheckbox>
</f:facet>
<h:selectBooleanCheckbox value="#{managedBeanName.registrosSelecionados[bean]}" />
</h:column>
</h:dataTable>
按钮“commandButtonRemoverSelected”只要调用的ActionListener在第二次点击。 当我删除以下行从datatabe一切工作正常(命令按钮被称为先点击):
<h:selectBooleanCheckbox value="#{managedBeanName.registrosSelecionados[bean]}" />
所以,我managedBean有一个叫做“registrosSelecionados”应该存贮一对“豆,布尔” MAP。 看到:
private Map<Bean, Boolean> registrosSelecionados = new HashMap<Bean, Boolean>();