ICEfaces
  1. ICEfaces
  2. ICE-7312

Automatic Ajax broken after navigation

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-2.0.0.GA, 2.0.2
    • Fix Version/s: 2.1-Beta2, 3.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      Mojarra 2.1.2
    • Assignee Priority:
      P2

      Description

      After a JSF navigation, the next request is not an Ajax one. This happens because the JavaScript which captures form submits is missing in the page.

      The problem is org.icefaces.impl.FormSubmit: The "guard against duplicates within the same JSF lifecycle" doesn't work in case of navigation because it relies on a FacesContext attribute. After a navigation the attribute is still there but because the ViewRoot changed the scriptWriter is actually not contained as a children of the form anymore.

        Activity

        Hide
        Adrian Gygax added a comment -

        Attached a sample project including a patched FormSubmit which fixes the problem (See the "PATCHED" comment).

        To reproduce the problem simply remove the patched class and click twice on the button. The second button click will issue a normal request, not an Ajax one and the <script> tag is missing in the DOM.

        Show
        Adrian Gygax added a comment - Attached a sample project including a patched FormSubmit which fixes the problem (See the "PATCHED" comment). To reproduce the problem simply remove the patched class and click twice on the button. The second button click will issue a normal request, not an Ajax one and the <script> tag is missing in the DOM.
        Hide
        Ted Goddard added a comment -

        Request scope attribute or View Scope attribute can be used instead of FacesContext attribute (request scope likely preferred).

        Navigation tests need to be checked to see why this passed regression.

        Show
        Ted Goddard added a comment - Request scope attribute or View Scope attribute can be used instead of FacesContext attribute (request scope likely preferred). Navigation tests need to be checked to see why this passed regression.
        Hide
        Ted Goddard added a comment -

        It was also observed that a dummy bean is always added to window scope resulting in extra HTTP requests upon every navigation.

        Show
        Ted Goddard added a comment - It was also observed that a dummy bean is always added to window scope resulting in extra HTTP requests upon every navigation.
        Hide
        Mircea Toma added a comment -

        Change duplicate detection logic to check for the existence of the dynamically added component among the children of the current form instead of checking a flag set in the FacesContext's attribute map.

        The recommended fix was applied with a slight modification, the flag set in the FacesContext's attribute map to detect duplicates was removed since it became redundant.

        Show
        Mircea Toma added a comment - Change duplicate detection logic to check for the existence of the dynamically added component among the children of the current form instead of checking a flag set in the FacesContext's attribute map. The recommended fix was applied with a slight modification, the flag set in the FacesContext's attribute map to detect duplicates was removed since it became redundant.
        Hide
        Mircea Toma added a comment -

        The "view scope retained test" case in 'scopes' application was detecting this issue already, so there is no need for additional tests.

        Show
        Mircea Toma added a comment - The "view scope retained test" case in 'scopes' application was detecting this issue already, so there is no need for additional tests.

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Adrian Gygax
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: