Uploaded image for project: 'MyFaces Tobago'
  1. MyFaces Tobago
  2. TOBAGO-2287

Avoid error msg when using cc:clientBehavior with target attribute and f:ajax and @this

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 6.2.0
    • 5.11.0, 6.3.0
    • Core
    • None

    Description

      Error:

       o.a.myfaces.tobago.util.ComponentUtils   : No component found for id='@this:selected-values', search base component is 'page:filter-roles:selected-values' 

      in composite component:

      <cc:clientBehavior name="onSelectFilterCheckbox" event="change" targets="selected-values"/> 

       

      Code in org.apache.myfaces.view.facelets.tag.faces.core.AjaxHandler there is something like this

      // execute is required
      Collection<String> execute = ajaxBehavior.getExecute();              
      if (execute.isEmpty() || execute.contains("@this"))
      {
          Collection<String> newExecute = new ArrayList<>(execute);
          newExecute.remove("@this");
          for (String target : targetsArray)
          {
              newExecute.add("@this" + separatorChar + target);
          }
          ajaxBehavior.setExecute(newExecute);
      }
      
      // render is optional
      Collection<String> render = ajaxBehavior.getRender();              
      if (render.contains("@this"))
      {
          Collection<String> newRender = new ArrayList<>(render);
          newRender.remove("@this");
          for (String target : targetsArray)
          {
              newRender.add("@this" + separatorChar + target);
          }
          ajaxBehavior.setRender(newRender);
      } 

       

       

      We need to handle @this:<id> in ComponentUtils. Still I think the myfaces core code is wrong the '@this' should be enough

      Attachments

        Activity

          People

            bommel Bernd Bohmann
            bommel Bernd Bohmann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: