Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-2480

@ResourceDependencies does not work on custom behaviors

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0-alpha
    • 2.0.0-beta-2
    • None
    • None

    Description

      I created a simple custom behavior, that requires (more ships ) a simple JS file. On the RI (run-time testing) it works. Not so on myfaces2 trunk

      My class:
      package net.wessendorf;

      import java.util.EnumSet;
      import java.util.Set;

      import javax.faces.application.ResourceDependencies;
      import javax.faces.application.ResourceDependency;
      import javax.faces.component.behavior.ClientBehaviorBase;
      import javax.faces.component.behavior.ClientBehaviorContext;
      import javax.faces.component.behavior.ClientBehaviorHint;
      import javax.faces.component.behavior.FacesBehavior;

      @FacesBehavior("net.wessendorf.Confirm")
      @ResourceDependencies({
      @ResourceDependency(name="tester.js", library="wessi", target="head")
      })
      public class TestConfirmBehavior extends ClientBehaviorBase
      {

      @Override
      public String getScript(ClientBehaviorContext behaviorContext)

      { return "return confirm('Really')"; }

      @Override
      public Set<ClientBehaviorHint> getHints()

      { return EnumSet.of(ClientBehaviorHint.SUBMITTING); }

      }

      taglib.xml file:
      <facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
      version="2.0">

      <namespace>http://wessendorf.net/behavior</namespace>
      <tag>
      <tag-name>confirm</tag-name>
      <behavior>
      <behavior-id>net.wessendorf.Confirm</behavior-id>
      </behavior>
      </tag>
      </facelet-taglib>

      tester.js file:
      test = function()
      {
      alert('HALLO JSF2');
      }

      Attachments

        1. BehaviorResources.patch
          14 kB
          Ingo Hofmann

        Activity

          People

            matzew Matthias Wessendorf
            matzew Matthias Wessendorf
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: