Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3
    • Component/s: Lifecycle
    • Labels:
      None

      Description

      In JSF 2.0 a PreRenderViewEvent was added that is published just before a view is rendered, but there's no corresponding event published just after rendering a view.

      There are several alternatives for this, but none of them is really perfect. A per-view PhaseListener can be used, but it fires relatively early and sticks around after a post-back which may be undesirable. A global PhaseListener that picks up a delegating listener in request scope is another option that does work, but is not as intuitively clear (we use this approach in OmniFaces' CallbackPhaseListener).

      I therefor propose to add a PostRenderViewEvent that is published right after a view is rendered.

      Among the use cases for such an event is doing per request clean-ups; for instance a view scoped backing bean where a value is set such that for one particular request an item is rendered with some emphasis and then after the first post-back rendered normally again.

        Issue Links

          Activity

          Hide
          arjan tijms added a comment -

          Draft of PostRenderViewEvent implementation including rudimentary test.

          Show
          arjan tijms added a comment - Draft of PostRenderViewEvent implementation including rudimentary test.
          Hide
          kithouna added a comment -

          Would be great if this can still be put in JSF 2.2. Seems to be a very trivial thing.

          Show
          kithouna added a comment - Would be great if this can still be put in JSF 2.2. Seems to be a very trivial thing.
          Hide
          kithouna added a comment -

          On second thoughs, don't add this to JSF 2.2 for the mere reason that the team should focus 100% on polishing and finishing work that has already started and should not do anything new for 2.2.

          For 2.3 this would be really great though

          Show
          kithouna added a comment - On second thoughs, don't add this to JSF 2.2 for the mere reason that the team should focus 100% on polishing and finishing work that has already started and should not do anything new for 2.2. For 2.3 this would be really great though
          Hide
          Ed Burns added a comment -

          Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

          Show
          Ed Burns added a comment - Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.
          Hide
          Manfred Riem added a comment -

          Setting priority to Major

          Show
          Manfred Riem added a comment - Setting priority to Major
          Hide
          Manfred Riem added a comment -

          Implementation changes have been applied. See the associated implementation issue.

          Arjan, please review the specification PDF to see if there is additional information to be added from a specification perspective.

          Thanks!

          Show
          Manfred Riem added a comment - Implementation changes have been applied. See the associated implementation issue. Arjan, please review the specification PDF to see if there is additional information to be added from a specification perspective. Thanks!
          Hide
          arjan tijms added a comment -

          Section 2.2.6 now contains the following:

          Upon completion of rendering, the completed state of the view must have been saved using the methods of the class StateManager. This state information must be made accessible on a subsequent request, so that the Restore View can access it.[P1-end]

          I propose to change this to:

          Upon completion of rendering, the completed state of the view must have been saved using the methods of the class StateManager. This state information must be made accessible on a subsequent request, so that the Restore View can access it.

          Publish the javax.faces.event.PostRenderViewEvent. (generally this is directly after the call to ViewHandler.renderView())
          [P1-end]

          Section 3.4.3.1 now contains the following:

          PreRenderComponentEvent indicates that the source component is about to be rendered. Please see Section 3.1.7 “Component Tree Manipulation” for a reference to the normative specification.

          PreRenderViewEvent indicates that the UIViewRoot source component is about to be rendered. Please see Section 2.2.6 “Render Response” for the normative specification.

          PreValidateEvent indicates that an individual component instance is about to be validated. Please see the EditableValueHolder Section 3.2.7.3 “Events” for the normative specification.

          I propose to change this to:

          PreRenderComponentEvent indicates that the source component is about to be rendered. Please see Section 3.1.7 “Component Tree Manipulation” for a reference to the normative specification.

          PreRenderViewEvent indicates that the UIViewRoot source component is about to be rendered. Please see Section 2.2.6 “Render Response” for the normative specification.

          PostRenderViewEvent indicates that the UIViewRoot source component has just been rendered. Please see Section 2.2.6 “Render Response” for the normative specification.

          PreValidateEvent indicates that an individual component instance is about to be validated. Please see the EditableValueHolder Section 3.2.7.3 “Events” for the normative specification.

          Show
          arjan tijms added a comment - Section 2.2.6 now contains the following: Upon completion of rendering, the completed state of the view must have been saved using the methods of the class StateManager. This state information must be made accessible on a subsequent request, so that the Restore View can access it. [P1-end] I propose to change this to: Upon completion of rendering, the completed state of the view must have been saved using the methods of the class StateManager. This state information must be made accessible on a subsequent request, so that the Restore View can access it. Publish the javax.faces.event.PostRenderViewEvent. (generally this is directly after the call to ViewHandler.renderView()) [P1-end] Section 3.4.3.1 now contains the following: PreRenderComponentEvent indicates that the source component is about to be rendered. Please see Section 3.1.7 “Component Tree Manipulation” for a reference to the normative specification. PreRenderViewEvent indicates that the UIViewRoot source component is about to be rendered. Please see Section 2.2.6 “Render Response” for the normative specification. PreValidateEvent indicates that an individual component instance is about to be validated. Please see the EditableValueHolder Section 3.2.7.3 “Events” for the normative specification. I propose to change this to: PreRenderComponentEvent indicates that the source component is about to be rendered. Please see Section 3.1.7 “Component Tree Manipulation” for a reference to the normative specification. PreRenderViewEvent indicates that the UIViewRoot source component is about to be rendered. Please see Section 2.2.6 “Render Response” for the normative specification. PostRenderViewEvent indicates that the UIViewRoot source component has just been rendered. Please see Section 2.2.6 “Render Response” for the normative specification. PreValidateEvent indicates that an individual component instance is about to be validated. Please see the EditableValueHolder Section 3.2.7.3 “Events” for the normative specification.
          Hide
          Manfred Riem added a comment -

          Applied to 2.3 trunk,

          svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1135, Add PostRenderViewEvent"
          Sending spec/frame/requestProcessingLifecycle.fm
          Sending spec/frame/userInterfaceComponentModel.fm
          Transmitting file data ..
          Committed revision 1160.

          Show
          Manfred Riem added a comment - Applied to 2.3 trunk, svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1135 , Add PostRenderViewEvent" Sending spec/frame/requestProcessingLifecycle.fm Sending spec/frame/userInterfaceComponentModel.fm Transmitting file data .. Committed revision 1160.

            People

            • Assignee:
              Manfred Riem
              Reporter:
              arjan tijms
            • Votes:
              5 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: