MyFaces Core
  1. MyFaces Core
  2. MYFACES-3610

Dynamically created ClientBehaviors do not call addComponentResource

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.7
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      I'm creating this as a JIRA issue so that I can attach a test case. However it behaves the same on Mojarra as on MyFaces so possibly it is 'by design'?

      My question is this:

      • If I dynamically create UIComponents using Application.createComponent, I find they automatically add any dependent resources (JS/CSS) to the h:head. This is fantastic.
      • If I dynamically create ClientBehaviours using Application.createBehavior, no dependent resources get added.

      Am I supposed to add such resources manually? For example:

      UIOutput js = new UIOutput();
      js.setRendererType("javax.faces.resource.Script");
      js.getAttributes().put("library", "mylibrary");
      js.getAttributes().put("name", "bar.js");

      FacesContext context = FacesContext.getCurrentInstance();
      context.getViewRoot().addComponentResource(context, js, "head");

      If so, how am I supposed to know what they are? For example, if I am dynamically adding an AjaxBehavior the exact name of the JavaScript file depends on which JSF implementation I am using.

      1. DynamicBehaviourTest.zip
        3.73 MB
        Kennard Consulting

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Kennard Consulting
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development