ICEfaces
  1. ICEfaces
  2. ICE-10257

@WindowDisposed - ViewScoped bean constructor called on redirect

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0.BETA, EE-3.3.0.GA_P02
    • Fix Version/s: 4.0, EE-3.3.0.GA_P03
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      All

      Description

      When using the @WindowDisposed annotation for a ViewScoped bean, this beans constructor is called when doing a redirect to a new page.

      Scenario:
       - TestBean - ViewScoped bean
       - PageBean - ViewScoped Bean

      When the page that uses TestBean is loaded the constructor is called as expected. This page has a commandButton which will do a redirect to the page that uses PageBean. On click of this button the TestBean constructor is called as well as the PageBean constructor.

      Removing the @WindowDisposed annotation prevents this additional call to the constructor.

        Activity

        Hide
        Arran Mccullough added a comment -

        Attached test case that shows the issue. Note: The icefaces-ee, icefaces-ee-ace, and icefaces-ee-compat jars need to be added back into war file to run.

        Steps are as mentioned in the original case description.

        Show
        Arran Mccullough added a comment - Attached test case that shows the issue. Note: The icefaces-ee, icefaces-ee-ace, and icefaces-ee-compat jars need to be added back into war file to run. Steps are as mentioned in the original case description.
        Hide
        Arran Mccullough added a comment -

        This also doesn't seem to be an issue with the E 3.3.0 P01 release.

        Show
        Arran Mccullough added a comment - This also doesn't seem to be an issue with the E 3.3.0 P01 release.
        Hide
        Ken Fyten added a comment -

        Also verify that this issue isn't occurring with icefaces4/trunk.

        Show
        Ken Fyten added a comment - Also verify that this issue isn't occurring with icefaces4/trunk.
        Hide
        Mircea Toma added a comment -

        Run the disposal of view or window scoped beans before the render phase is executed. This will also short-circuit the JSF lifecycle early to avoid having the beans initialised.

        Show
        Mircea Toma added a comment - Run the disposal of view or window scoped beans before the render phase is executed. This will also short-circuit the JSF lifecycle early to avoid having the beans initialised.
        Hide
        Mircea Toma added a comment -

        Applied fix to trunk as well.

        Show
        Mircea Toma added a comment - Applied fix to trunk as well.
        Hide
        Arran Mccullough added a comment -

        This issue is still reproducible when there is an ace:dataTable included on one of the pages.

        Show
        Arran Mccullough added a comment - This issue is still reproducible when there is an ace:dataTable included on one of the pages.
        Hide
        Arran Mccullough added a comment -

        Re-attached test case that shows the issue. Note: The icefaces-ee, icefaces-ee-ace, and icefaces-ee-compat jars need to be added back into war file to run.

        This time, pageOne.xhtml has an ace:dataTable on the page. Upon navigating from Page to Test, the PageBean constructor is called again. Sample output logs:

        Test Bean Constructor Called - Initial Test page load
        Page Bean Constructor Called - Navigation to Page load
        Page Bean Dispose Called - Navigation to Test page
        Page Bean Constructor Called - Navigation to Test page
        Page Bean Dispose Called - Navigation to Test page
        Test Bean Constructor Called - Test page load

        Show
        Arran Mccullough added a comment - Re-attached test case that shows the issue. Note: The icefaces-ee, icefaces-ee-ace, and icefaces-ee-compat jars need to be added back into war file to run. This time, pageOne.xhtml has an ace:dataTable on the page. Upon navigating from Page to Test, the PageBean constructor is called again. Sample output logs: Test Bean Constructor Called - Initial Test page load Page Bean Constructor Called - Navigation to Page load Page Bean Dispose Called - Navigation to Test page Page Bean Constructor Called - Navigation to Test page Page Bean Dispose Called - Navigation to Test page Test Bean Constructor Called - Test page load
        Hide
        Mircea Toma added a comment -

        Added navigation handler that collects the names of the view scoped beans that are about to be disposed by JSF's ViewScopeManager before a redirect navigation. After navigation the handler will add no-op beans (mapped to the collected names) to the view map to avoid having the bean recreated (and promptly disposed) when dispose-window request comes in. This strategy also avoids having the dispose methods invoked twice.

        Show
        Mircea Toma added a comment - Added navigation handler that collects the names of the view scoped beans that are about to be disposed by JSF's ViewScopeManager before a redirect navigation. After navigation the handler will add no-op beans (mapped to the collected names) to the view map to avoid having the bean recreated (and promptly disposed) when dispose-window request comes in. This strategy also avoids having the dispose methods invoked twice.
        Hide
        Ken Fyten added a comment -

        Re-opened for the MyFaces JSF 2.1 issue noted above.

        Show
        Ken Fyten added a comment - Re-opened for the MyFaces JSF 2.1 issue noted above.
        Hide
        Mircea Toma added a comment -

        Introduced view scoped bean that records when redirect navigation is triggered, when that occurs our WindowScopeManager will avoid to dispose the view scoped beans that are annotated with @WindowDisposed.

        Show
        Mircea Toma added a comment - Introduced view scoped bean that records when redirect navigation is triggered, when that occurs our WindowScopeManager will avoid to dispose the view scoped beans that are annotated with @WindowDisposed.
        Hide
        Carmen Cristurean added a comment - - edited

        Verified on EE-3.3.0-maintenance-branch rev. 44065 w/MyFaces 2.1.17, and Mojarra 2.1.29 (IE11, Chrome40, FF34).

        Show
        Carmen Cristurean added a comment - - edited Verified on EE-3.3.0-maintenance-branch rev. 44065 w/MyFaces 2.1.17, and Mojarra 2.1.29 (IE11, Chrome40, FF34).

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: