我是 jsf 的新手,我想将 primeface 的 contextMenu 用于删除方法。但是永远不会调用删除方法。这是部分代码。我不知道我错在哪里
<p:dataTable id="dataTable" var="bon" widgetVar="bonTable" value="#{bonEssenceBean.allBonEssence}" rowKey="#{bon.idBon}" selection="#{bonEssenceBean.bonEssence}" selectionMode="single" sortMode="single" rows="10" paginator="true" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,15,25">
<f:facet name="header">
<p:outputPanel>
<h:outputText value="Search:" style="Height:30px"/>
<p:inputText id="globalFilter" onkeyup="bonTable.filter()" style="width:150px" />
</p:outputPanel>
</f:facet>
<!-- <p:ajax event="rowEdit" listener="#{bonEssence.updateBon}" /> -->
<!-- <p:ajax event="rowEditCancel" listener="#{tableBean.onCancel}" update=":form:messages" /> -->
<p:column sortBy="#{bon.idBon}" headerText="ID Bon" filterBy="#{bon.idBon}" filterMatchMode="contains">
#{bon.idBon}
</p:column>
<p:column sortBy="#{bon.vehicule.immat}" headerText="Vehicule:" filterBy="#{bon.vehicule.immat}" filterMatchMode="contains">
#{bon.vehicule.immat}
</p:column>
<p:column sortBy="#{bon.quantite}" headerText="Quantité:" filterBy="#{bon.quantite}" filterMatchMode="contains">
#{bon.quantite}
</p:column>
<p:column sortBy="#{bon.prix}" headerText="Prix" filterBy="#{bon.prix}" filterMatchMode="contains">
#{bon.prix}
</p:column>
<p:column sortBy="#{bon.dateBon}" headerText="Date" filterBy="#{bon.dateBon}" filterMatchMode="contains">
#{bon.dateBon}
</p:column>
<p:column>
<p:commandButton value="Imprimer" icon="ui-icon-search" oncomplete="printDialog.show()" >
<f:setPropertyActionListener target="#{bonEssenceBean.bonEssence}" value="#{bon}"></f:setPropertyActionListener>
</p:commandButton>
</p:column>
<p:column>
<h:commandButton value="Delete" update="dataTable" icon="ui-icon-close" actionListener="#{bonEssenceBean.deleteBo}" >
<f:setPropertyActionListener target="#{bonEssenceBean.bonEssence}" value="#{bon}"></f:setPropertyActionListener>
</h:commandButton>
</p:column>
<!-- <h:column headerText="delete">
<h:commandLink id="Delete" actionListener="#{bonEssenceBean.deleteBon}">
<h:outputText value="Delete" />
<f:param id="deleteId" name="id" value="#{bonEssence.idBon}" />
</h:commandLink>
</h:column>-->
</p:dataTable>
</h:form>
管理
public void deleteBon(ActionEvent event){
System.out.println("delete");
essenceService.deleteBon(bonEssence);
}
并且 deleteBon 从未调用过