I am working on a project on JSF2.0
Here is my code
CountBean.java
count = 1;
function increase() {
this.count++;
}
function decrease() {
this.count--;
}
count.xhtml
<ui:Fragment rendered="#{countBean.count > 100}">
<h:commandButton id="submit-button" value="increase" action="countBean.increase"/>
</ui:Fragment>
<ui:Fragment rendered="#{countBean.count > 0}">
<h:commandButton id="submit-button" value="decrease" action="countBean.decrease"/>
</ui:Fragment>
I run the application and have 2 tabs on Chorme
tab1: Show 2 buttons increase and decrease. Execute button decrease and then switch to tab2
tab2: Show 2 buttons increase and decrease. Execute button decrease
On tab1, the function decrease is run
When performing the submit button in tab2, the page is reloaded, the decrease function is not run, instead only the increase button is displayed
I don't understand why the code is running like that, thanks for your support