0
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.

Stuart M
  • 11,458
  • 6
  • 45
  • 59
Dave
  • 487
  • 1
  • 6
  • 19
  • 1
    What's your real problem? – Luiggi Mendoza Apr 17 '13 at 04:42
  • `transient="true"` basically destroys and disables the view scope (all view scoped beans become effectively request scoped). What exactly did you expect otherwise? Even then, view scoped beans are per definition destroyed during page-to-page navigation because it concerns a different view. What exactly is it, the functional requirement for which you thought that this would be the proper solution? – BalusC Apr 17 '13 at 13:10
  • basically prepare data in invoke Application phase, which will be used in a render Phase of a new page. – Dave Apr 17 '13 at 15:59

0 Answers0