Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-13252

a4j:ajax includes jsf.js script twice

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.3.4
    • Fix Version/s: 4.3.5, 4.5.0.Alpha2, 5.0.0.Alpha3
    • Component/s: component-a4j-core
    • Labels:
      None
    • Environment:

      any browser

      EAP 6.2 (Mojarra 2.1.19)
      EAP 6.1 (Mojarra 2.1.19)
      JBoss AS 7.1.1 (Mojarra 2.1.7)

    • Sprint:
      4.3.5 Sprint 1
    • Steps to Reproduce:
      Hide

      1. build and deploy the enclosed reproducer
      2. goto http://localhost:8080/ajax_test/index.jsf - f:ajax (index2.jsf - a4j:ajax)
      3. Check the elements on the page, you can see 1 script tag (2 script tags with a4j:ajax) pointing to jsf.js

      Show
      1. build and deploy the enclosed reproducer 2. goto http://localhost:8080/ajax_test/index.jsf - f:ajax (index2.jsf - a4j:ajax) 3. Check the elements on the page, you can see 1 script tag (2 script tags with a4j:ajax) pointing to jsf.js
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Specify jsf.js dependency (or use a component that depends on the jsf.js) before <h:commandLink/> is used.

      1) specify <h:outputScript library='javax.faces' name='jsf.js' target='head' /> in page head
      2) use equivalent <r:commandLink /> instead of <h:commandLink />

      Show
      Specify jsf.js dependency (or use a component that depends on the jsf.js ) before <h:commandLink/> is used. 1) specify <h:outputScript library='javax.faces' name='jsf.js' target='head' /> in page head 2) use equivalent <r:commandLink /> instead of <h:commandLink />

      Description

      When a4j:script is used in the page like so:

      <h:commandLink value="Click me ">
          <a4j:ajax event="click" render="@form"/>
      </h:commandLink>
      

      Then two script tags pointing to jsf.js are added to the page, once in the head by the inclusion of @ResourceDependency [1], and once again by Overriding the ClientBehaviorRenderer#getScript method [2,3].

      Note, that according to Brian, resolving this without introducing any functional regressions may require the resolution of RF-12270 [4].

      [1] https://github.com/richfaces/richfaces/blob/master/framework/src/main/java/org/richfaces/ui/ajax/ajax/AjaxBehaviorRenderer.java#L53
      [2] https://github.com/richfaces/richfaces/blob/master/framework/src/main/java/org/richfaces/ui/ajax/ajax/AjaxBehaviorRenderer.java#L123
      [3] https://github.com/jboss/mojarra/blob/2.1.21-jbossorg-1/jsf-api/src/main/java/javax/faces/render/ClientBehaviorRenderer.java#L95
      [4] https://issues.jboss.org/browse/RF-12270

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  lfryc Lukáš Fryč
                  Reporter:
                  jtrantin Jonáš Trantina
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - 4 hours
                    4h
                    Remaining:
                    Remaining Estimate - 4 hours
                    4h
                    Logged:
                    Time Spent - Not Specified
                    Not Specified