Uploaded image for project: 'PUBLIC - Liferay Faces'
  1. PUBLIC - Liferay Faces
  2. FACES-1400

Develop ViewScopePhaseListener in order to support @ManagedProperty injection with MyFaces Core Runtime



      The JSF2 @ViewScoped annotation provides a scope that is tied to the current JSF view, and the managed-bean instances are stored in the map that is found in UIViewRoot.getViewMap().

      The Liferay Faces project has many demos that have managed beans that utilize @ViewScoped and also use the @ManagedProperty annotation in order to inject model beans into backing beans. One such example would be ApplicantBackingBean.java from the jsf2-portlet demo.

      When running under Mojarra, @ViewScoped managed-beans are essentially stored in the underlying session. When running under MyFaces, @ViewScoped managed-beans are serialized after the JSF lifecycle runs, probably so that they don't take up memory on the server. When doing a postback to a @ViewScoped managed-bean, Mojarra simply pulls the live instance from the session. But with MyFaces, the managed-bean must be deserialized. The problem with this is that MyFaces does not re-inject @ManagedProperty values after deserialization.

      In order to workaround this problem, this task involves developing a ViewScopePhaseListener that will re-inject managed-bean instances after a postback.




            • Assignee:
              neil.griffin Neil Griffin
              neil.griffin Neil Griffin
              Participants of an Issue:
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: