I use Jsf2 and Primefaces.

I'm having trouble passing an attribute with p:commandButton. Is there any way to do it?

Here is what I'm trying to do:

<h:form>
<p:confirmDialog message="Delete the item?" showEffect="bounce" hideEffect="explode" header="Delete?" severity="alert" widgetVar="confirmation">
<p:commandButton value="Yes" oncomplete="confirmation.hide()" actionListener="#{backingBean.delete}" />
<p:commandButton value="No" onclick="confirmation.hide()" type="button" />
</p:confirmDialog>

<p:dataTable var="item" value="#{backingBean.xxList}" paginator="true" rows="10">
<p:column >
<p:commandButton value="Delete" onclick="confirmation.show()" type="button" ajax="false">
<f:attribute name="idItem" value="#{item.id}" />
</p:commandButton>
</p:column>

...

</p:dataTable>
</h:form>


In the actionListener I try to retrieve the attribute:

int idItem = ((Integer)event.getComponent().getAttributes().get ("idItem")).intValue();



but instead I get a damn nullpointer.

With h:commandButton I've been able to pass attributes but it seems to me that h:commandButton does not work with p:confirmDialog, does it?

Thanks.