I need an initializer method in the backing bean to be called after components are bind. @PostConstruct is called before component bindings. Is there any JSF annotation for methods which cause method call after component binding?
Currently it's possible to use something like <f:view afterPhase="#{bean.initialize}">
or <f:event type="preRenderView" listener="#{bean.initialize}" />
which requires code on page side and bean side. Is there any bean-side-only solution?
There's nothing like that in standard JSF API.
Closest what you can get is lazy loading in getter.
public UIComponent getSomeComponent() {
if (!initialized(someComponent)) {
initialize(someComponent);
}
return someComponent;
}
or lazy executing in setter.
public void setSomeComponent(UIComponent someComponent) {
if (!initialized(someComponent)) {
initialize(someComponent);
}
this.someComponent = someComponent;
}