Page foo.xhtml
--------------
<f:view transient="#{fooBean.transient}">
...
</f:view>
@ViewScoped("fooBean")
public class FooBean {
private boolean _transient = false;
public void setTransient(boolean t) {
_transient = t;
}
public boolean isTransient() {
return _transient;
}
}
During invoke application of page bar.xhtml, a fooBean is created, fooBean.setTransient(true), default is false. Then navigate to page foo.xhml, how to make the page foo.xhtml use the fooBean created during invoke application phase?
I tried to use preRenderEvent to set the fooBean to be managed by
FacesContext context = FacesContext.getCurrentInstance();
context.getApplication ().getELResolver().setValue(context.getELContext(), null, "fooBean", fooBean);
but it is too late. The UIViewRoot.transient has been set during buildView()
. I am wondering if there is any callback during buildView()
before calling #{fooBean.transient}
so that I can set the fooBean
to be managed by JSF.
Thanks for help.