ViewController does not invoke initView on new instance of same view
--------------------------------------------------------------------

                 Key: ORCHESTRA-30
                 URL: https://issues.apache.org/jira/browse/ORCHESTRA-30
             Project: MyFaces Orchestra
          Issue Type: Bug
    Affects Versions: 1.2
            Reporter: Simon Kitching


The "lifecycle" methods for backing beans are executed via the 
ViewControllerPhaseListener. In particular, for the initView call it checks at 
the beginning of every phase whether the current view has had the initView run 
on it for the current request-cycle, and if not then runs it.

It therefore needs to remember whether initView has been executed for a view in 
this request. This is done by keeping a map keyed by viewId.

However it is reasonable for an action method to "reset" a view by calling
  Conversation.getCurrent().invalidate()
  return "";

In this case, the new view is rendered and a new backing bean is created, but 
the viewId is the same so the ViewController does not call the initView 
lifecycle method.

One possible workaround is to define a navigation-case using <redirect/>, which 
means the new view is rendered in a new request-cycle and therefore the 
ViewController is run.

The code could be changed to use System.identityHashCode(viewRoot) rather than 
viewRoot.getViewId() as the map key; that would ensure we run the lifecycle 
methods when the viewRoot *object* changes even if it has the same viewId.

But perhaps what we really want is to run the lifecycle method if the backing 
bean is new, regardless of whether the view-tree is new or not? Looks like we 
need to more clearly define exactly what "initView" means....

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to