We are trying to migrate from Richfaces to Primefaces, but we have a very strange problem and any help is welcome.
Imagine a simple page with this content:
...
Code: Select all
<h:form id="myform">
<a4j:commandButton id="aaa" action="#{testBean.init()}" oncomplete="alert(#{testBean.counter});"
render="test" value="aaaa"/>
<h:outputText id="test" value="#{testBean.counter}"/>
</h:form>
in bean we have:
Code: Select all
public void init(){
setShowModal(true);
counter++;
}
public int getCounter() {
return counter;
}
public void setCounter(int counter) {
this.counter = counter;
}
So with PrimeFaces later than 6.0.6 "oncomplete" and outputText shows different values.
As a matter of fact, oncomplete returns the value before incrementation.
This mean that oncomplete is triggered before action init().
The strange is, that PrimeFaces.jar is included in the project, but it is not used on the page.
Is this a bug or feature?