MyFaces Core
  1. MyFaces Core
  2. MYFACES-3096

Attached object pointing to the same component twice add one of them twice


    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.4
    • Fix Version/s: 2.0.5
    • Component/s: JSR-314
    • Labels:


      In this example:

      <testComposite:compositeActionTargetAttributeName id="cc1">
      <f:actionListener for="submitButton" binding="#


      <f:actionListener for="cancelButton" binding="#




      <cc:actionSource name="submitButton" targets="submitCancelButton"/>
      <cc:actionSource name="cancelButton" targets="submitCancelButton"/>
      <testComposite:actionTargetAttributeName id="submitCancelButton"/>


      <cc:actionSource name="submitButton"/>
      <cc:actionSource name="cancelButton" targets="cancelAction"/>
      <h:commandButton id="submitButton" value="Submit Button"/>
      <h:commandButton id="cancelAction" value="Cancel Button"/>

      for one of the buttons a f:actionListener is added twice. The problem resides in this code:

      if (UIComponent.isCompositeComponent(component))

      { // How we obtain the list of AttachedObjectHandler for // the current composite component? It should be a component // attribute or retrieved by a key inside component.getAttributes // map. Since api does not specify any attribute, we suppose // this is an implementation detail and it should be retrieved // from component attribute map. // But this is only the point of the iceberg, because we should // define how we register attached object handlers in this list. // ANS: see CompositeComponentResourceTagHandler. // The current handler should be added to the list, to be chained. // Note that the inner component should have a target with the same name // as "for" attribute mctx.addAttachedObjectHandler(component, currentHandler); List<AttachedObjectHandler> handlers = mctx.getAttachedObjectHandlers(component); retargetAttachedObjects(context, component, handlers); }

      The next time it is called call again retargetAttachedObjects, but for the other attached object, the previous one is still on the list. In CompositeComponentResourceTagHandler all handlers are removed to prevent apply them twice, but in this special case, it is necessary to remove it manually adding some code like this:



        Leonardo Uribe created issue -
        Leonardo Uribe made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0.5-SNAPSHOT [ 12316168 ]
        Resolution Fixed [ 1 ]
        Leonardo Uribe made changes -
        Fix Version/s 2.0.5 [ 12316346 ]
        Fix Version/s 2.0.5-SNAPSHOT [ 12316168 ]
        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: