I've the following JSF page to try either standard JSF2.2.1 and Primefaces4 CommandLink:
<h:form id="test3" binding="#{test3.hf}">
<h:commandLink value="Test3" action="#{test3.print('PROVA.....')}" />
<br />
<p:commandLink value="PFtest" action="#{test3.print('PROVA.....')}" />
</h:form>
... and the relative ViewScoped managed bean:
@ManagedBean(name="test3")
@ViewScoped
public class Test3 implements Serializable {
HtmlForm hf;
public Test3() {
super();
}
public HtmlForm getHf() {
return hf;
}
public void setHf(HtmlForm hf) {
this.hf = hf;
}
public String print(String text) {
System.out.println(text + " " + System.currentTimeMillis());
System.out.println(hf.getChildren().size());
return null;
}
}
The strange behavior is that, clicking on one of two CommandLink, the print method is called two times !!!
The problem don't occurs if I avoid the form binding or I add an additional binding to CommandLink components.
What do you think about ? Thanks.
Solved by Mojarra 2.2.5. Thanks for contributes.