I tried apply rendered in order to check for if else conditional in JSF. (ref: Conditionally displaying JSF components)
This part is my JSF index.html
<p:commandButton value="Update Hidden Label" action="#{carForm.updateBool}" />
<h:outputText value="Text A" />
<h:outputText value=" Text B" rendered="#{carForm.booleanValue}" />
This is my java class
private boolean booleanValue;
public boolean isBooleanValue() {
return booleanValue;
}
public void setBooleanValue(final boolean booleanValue) {
this.booleanValue = booleanValue;
}
public void updateBool() {
booleanValue = true;
}
when I tried click on "Update Hidden Label", it would update the booleanValue in java class to true, however in index.html page "Text B" is still not appear yet.