How can I show an image depending on a boolean status variable that is triggered by a button? I do not want that entire page to reload, but just that specific image.
Facelets page:
</h:form>
<h:commandButton value="test" action="#{bean.toggleStatus}">
<f:ajax render="image"/>
</h:commandButton>
<h:graphicImage id="image" value="status.gif" rendered="#{bean.status}"/>
</h:form>
Backing class:
class Bean {
private boolean status = false;
public void toggleStatus() {
status = true;
}
//getter, setter
}
Any idea what might be wrong here?