MyFaces Core
  1. MyFaces Core
  2. MYFACES-3455

[myfaces-2.1.6-SNAPSHOT] Using f:ajax within h:commandButton to dynamic switch ui:include works not correct anymore

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.1.6-SNAPSHOT
    • Fix Version/s: 2.0.12, 2.1.6
    • Component/s: None
    • Labels:
      None

      Description

      If you click the ajaxified commandButton the ui:include switches.
      After a few clicks, the switch doesn't work correct anymore. You must click twice to switch the include, which is a bug.

      A testcase to reproduce this issue is attached. Note, that this issue doesn't appear within myfaces 2.1.5

      http://localhost:8080/jsftest/navtest.jsf

      1. jsftest2.war
        3.93 MB
        Rene O
      2. jsftest.war
        3.92 MB
        Rene O

        Activity

        Hide
        Rene O added a comment -

        I have test the new fix and now it works as expected. Thanks for fixing this so fast.

        Show
        Rene O added a comment - I have test the new fix and now it works as expected. Thanks for fixing this so fast.
        Hide
        Leonardo Uribe added a comment - - edited

        I checked the problem and it is caused because when f:facet contains more than one child, facelets algorithm create a panel that is not backed by any facelet tag, but it has ComponentSupport.FACET_CREATED_UIPANEL_MARKER to recognize it. Since it does not have ComponentSupport.MARK_CREATED associated, that panel is marked to remove, but it should not.

        The fix is just check that case on PostAddPreRemoveFromViewListener. It took me some time to figure it out, but now it should work.

        Thanks a lot for the test and the interest to check these cases, it is a very valuable contribution.

        Show
        Leonardo Uribe added a comment - - edited I checked the problem and it is caused because when f:facet contains more than one child, facelets algorithm create a panel that is not backed by any facelet tag, but it has ComponentSupport.FACET_CREATED_UIPANEL_MARKER to recognize it. Since it does not have ComponentSupport.MARK_CREATED associated, that panel is marked to remove, but it should not. The fix is just check that case on PostAddPreRemoveFromViewListener. It took me some time to figure it out, but now it should work. Thanks a lot for the test and the interest to check these cases, it is a very valuable contribution.
        Hide
        Rene O added a comment -

        New testcase

        Show
        Rene O added a comment - New testcase
        Hide
        Rene O added a comment -

        There is another problem:
        If you use a component like a h:datatable with a <f:facet name="header"> and have there a link to dynamic switch the include
        and another child, then the switching doesn't work as expected. It only works, if you have only one child in f:facet.
        Note, that this issue doesn't occur with myfaces-2.1.5

        A new testcase is attached. To reproduce this issue open http://localhost:8080/jsftest2/newnavtest.jsf and click the button a few times to see what happens.

        Show
        Rene O added a comment - There is another problem: If you use a component like a h:datatable with a <f:facet name="header"> and have there a link to dynamic switch the include and another child, then the switching doesn't work as expected. It only works, if you have only one child in f:facet. Note, that this issue doesn't occur with myfaces-2.1.5 A new testcase is attached. To reproduce this issue open http://localhost:8080/jsftest2/newnavtest.jsf and click the button a few times to see what happens.
        Hide
        Leonardo Uribe added a comment -

        I checked the code and the problem was caused because PostAddPreRemoveFromViewListener marked components to be removed. On a later request, the button is removed, so the event is not triggered and the view is not updated. The solution is just do not add to clientId removed list components backed by facelets algorithm and add them when preserve state is enabled.

        Thanks a lot for the test case. It helps a lot.

        Show
        Leonardo Uribe added a comment - I checked the code and the problem was caused because PostAddPreRemoveFromViewListener marked components to be removed. On a later request, the button is removed, so the event is not triggered and the view is not updated. The solution is just do not add to clientId removed list components backed by facelets algorithm and add them when preserve state is enabled. Thanks a lot for the test case. It helps a lot.

          People

          • Assignee:
            Leonardo Uribe
            Reporter:
            Rene O
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development