ICEfaces
  1. ICEfaces
  2. ICE-7182

The ICEfaces form decorations are not added during postbacks when running under MyFaces 2.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.1-Beta, 3.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      ICEfaces 2 MyFaces 2
    • Assignee Priority:
      P1

      Description

      On normal stock h: components, ICEfaces 'decorates' forms in order to add stuff needed for form submission. This includes:

            <input name="ice.window" type="hidden" value="fbgs26iu6l" />
            <input name="ice.view" type="hidden" value="veamhp42" />
            <script id="hForm:hForm_captureSubmit" type="text/javascript">
            ice.captureSubmit('hForm',false);ice.captureEnterKey('hForm');</script>

      This work is done in a class called FormSubmit and is implemented as SystemEventListener that listens for HtmlForm components that trigger PostAddToViewEvents:

      public class FormSubmit implements SystemEventListener {

              <system-event-listener>
                  <system-event-listener-class>org.icefaces.impl.event.FormSubmit</system-event-listener-class>
                  <system-event-class>javax.faces.event.PostAddToViewEvent</system-event-class>
              </system-event-listener>

      While this strategy appears to work fine in Mojarra, the form decorations are not being applied when running under MyFaces and the Ajax request is a postback.

        Issue Links

          Activity

          Hide
          Deryk Sinotte added a comment -

          Linking to parent MyFaces 2 compatibility case.

          Show
          Deryk Sinotte added a comment - Linking to parent MyFaces 2 compatibility case.
          Hide
          Deryk Sinotte added a comment -

          Linking to parent MyFaces 2 case.

          Show
          Deryk Sinotte added a comment - Linking to parent MyFaces 2 case.
          Hide
          Deryk Sinotte added a comment -

          Looking at the JavaDoc for PostAddToViewEvent for the 2.1.2 release:

          "The implementation must guarantee that Application.publishEvent(javax.faces.context.FacesContext, java.lang.Class, java.lang.Object) is called, immediately after any UIComponent instance is added to the view hierarchy except in the case where ResponseStateManager.isPostback(javax.faces.context.FacesContext) returns true at the same time as FacesContext.getCurrentPhaseId() returns PhaseId.RESTORE_VIEW. When both of those conditions are met, Application.publishEvent(javax.faces.context.FacesContext, java.lang.Class, java.lang.Object) must not be called."

          During an Ajax postback, with Mojarra, I added some logging to see when the FormSubmit.processEvent was being called when the Ajax request was sent:

          INFO: BEFORE RESTORE_VIEW 1 from /forms-mo/form.jsf isPostback=true
          FormSubmit.processEvent:
          source : javax.faces.component.html.HtmlForm@39750df6
          isPostback: true
          phase : RESTORE_VIEW 1

          The same call is never made running under MyFaces so the forms never get decorated with the ICEfaces values and scripts. It turns out that we're relying on a behaviour that probably shouldn't be occurring in Mojarra according to their own documentation. However, I think we may be able to safely change to using the PreRenderComponentEvent like we do for a couple of our other listeners.

          Show
          Deryk Sinotte added a comment - Looking at the JavaDoc for PostAddToViewEvent for the 2.1.2 release: "The implementation must guarantee that Application.publishEvent(javax.faces.context.FacesContext, java.lang.Class, java.lang.Object) is called, immediately after any UIComponent instance is added to the view hierarchy except in the case where ResponseStateManager.isPostback(javax.faces.context.FacesContext) returns true at the same time as FacesContext.getCurrentPhaseId() returns PhaseId.RESTORE_VIEW. When both of those conditions are met, Application.publishEvent(javax.faces.context.FacesContext, java.lang.Class, java.lang.Object) must not be called." During an Ajax postback, with Mojarra, I added some logging to see when the FormSubmit.processEvent was being called when the Ajax request was sent: INFO: BEFORE RESTORE_VIEW 1 from /forms-mo/form.jsf isPostback=true FormSubmit.processEvent: source : javax.faces.component.html.HtmlForm@39750df6 isPostback: true phase : RESTORE_VIEW 1 The same call is never made running under MyFaces so the forms never get decorated with the ICEfaces values and scripts. It turns out that we're relying on a behaviour that probably shouldn't be occurring in Mojarra according to their own documentation. However, I think we may be able to safely change to using the PreRenderComponentEvent like we do for a couple of our other listeners.
          Hide
          Deryk Sinotte added a comment -

          Change to the SystemEventListener has been checked in. It now uses the PreRenderComponentEvent which works in both Mojarra and MyFaces.

          Show
          Deryk Sinotte added a comment - Change to the SystemEventListener has been checked in. It now uses the PreRenderComponentEvent which works in both Mojarra and MyFaces.

            People

            • Assignee:
              Deryk Sinotte
              Reporter:
              Deryk Sinotte
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: