I would like to have a boolean semaphore
in my managed bean that denotes whether a JSF
page that utilizes it has completed rendering. By default, the value should be false and once the last bit of HTML has been rendered (or thereabouts), the value should be set to true and never again, during the lifecycle of the bean, should it go back to false.
I suppose one way to do it would be if I have a form to have a hidden input tied to a bean method which always sets the value of the semaphore to true. However, is there a way to accomplish this without a form?
On a per-view basis, you could use <f:view afterPhase>
for that.
<f:view afterPhase="#{bean.afterPhase}">
private boolean renderedOnce;
public void afterPhase(PhaseEvent event) {
if (event.getPhaseId() == PhaseId.RENDER_RESPONSE) {
renderedOnce = true;
}
}