MyFaces Core
  1. MyFaces Core
  2. MYFACES-2924

Component bindings are not reset when explicit navigation to the same page is derived from action


    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.6, 2.1.0
    • Component/s: JSR-314
    • Labels:


      It is possible to cause a duplicate id exception doing the following steps:

      • Render one page (let's call mypage.xhtml) with a component that has a binding to a request scope managed bean
      • Click the button

      <x:component binding="#


      <f:facet name="header">
      /.... some components here with non generated id ..../
      </f:facet name="header">
      <h:commandButton action="#



      public String someMethod()

      { return "mypage"; }

      That example should work without problem. The problem is raised by an optimization done in myfaces:


      if (mctx.isRefreshingTransientBuild())
      c = ComponentSupport.findChildByTagId(parent, id);

      If we are not refreshing the current view, it does not have sense to try to find a component that will not be found, right?

      The spec is clear about the effect of the previous example:

      JSF 2.0 section 7.4.2 : "...A rule match always causes a new view to be created, losing the state of the old view. This includes clearing out the view map....."

      but if you have component bindings on the page, all components inside the component with the binding will preserve the state. There is one simple solution from the user point of view (and this is what everyone usually does in this case):

      public String someMethod()

      { return null; }

      no rule match means no navigation, the view state is preserved and finally no duplicate id exception.

      If we disable the optimization code, the code will work, but there is still one problem with the spec.

      1. MYFACES-2924-1.patch
        10 kB
        Leonardo Uribe


        Leonardo Uribe created issue -
        Leonardo Uribe made changes -
        Field Original Value New Value
        Attachment MYFACES-2924-1.patch [ 12478224 ]
        Leonardo Uribe made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Leonardo Uribe made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Fix Version/s 2.0.6 [ 12316397 ]
        Fix Version/s 2.1.0 [ 12315190 ]
        Resolution Fixed [ 1 ]
        Leonardo Uribe made changes -
        Status Resolved [ 5 ] Closed [ 6 ]


          • Assignee:
            Leonardo Uribe
            Leonardo Uribe
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: