I have some problem with ViewScopedBean and dynamic inclusion of facelet-fragment.
My problem is, that I use value expression referenced my ViewScopedBean in tag
ui:include src="#{[MyViewScopedBean.myField]}" when trying to dynamically include some external xhtml-fragment, based on my internal logic.
So, after debugging I discovered, that this tag gets executed somewhere inside line vdl.buildView(context, viewRoot) of method restoreView of StateManagementStrategyImpl.class, but actual restoring of ViewScopeMap occures after that line...later in this method inside viewRoot.visitTree block.
So during buildView method, my manged-bean is null, because ViewMap is not restored yet, so it get's recreated by managed-bean infrastructure.
I understand, that this may not be an issue, but right behaviour,because you couldn't restore state of ViewRoot before it's initial building. So I need another way, to include dynamic fragments without using ViewScoped bean, to resolve my dinamic fragment name.
I tryed to use ViewScoped bean, because internal logic is rather heavy, and repeat it before every request is not preferabble. So ViewScoped facility was perfect candidate to store calculated fragment-name, without recalculating it before every ajax call later.
Any help appreciated.
p.s. SessionScoped bean works correclty, but SessionScope is too wide for my purpose.
[Message sent by forum member 'dumbuzz']
http://forums.java.net/jive/thread.jspa?messageID=480785