With the following code with primefaces 6.0
<p:diagram value="#{myBean.model}" var="m" >
<f:facet name="element">
<h:commandButton value="#{m.id}" action="#{myBean.test(m.id)}"/>
</f:facet>
</p:diagram>
and
@Named
@SessionScoped
public class MyBean implements Serializable {
.....
private DefaultDiagramModel model;
//getter and setter
public String test(int id) {
System.out.println("ID IS : " + id);
return null;
}
....
}
I get the value of the id on the button label (rendered on the xhtml page).
But I get always the number
ID IS : 0
on the IDE console
If I change my code with action="#{myBean.test(4)}"
I get in the IDE console
4
If I change my code with action="#{myBean.test(6)}"
I get in the IDE console
6
But when I come back to action="#{myBean.test(m.id)}"
I get always in the IDE console the number 0
But the value if the id is well rendered on button label on the xhtml page
Non Exception is thrown!
Any help please?