ICEfaces
  1. ICEfaces
  2. ICE-7619

The jsf.js file is loaded twice when h:commandLink is present

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.RC2
    • Fix Version/s: 3.0
    • Component/s: Framework, Sample Apps
    • Labels:
      None
    • Environment:
      ICEfaces 3 Mojarra
    • Assignee Priority:
      P2

      Description

      I haven't noticed the same behaviour with MyFaces but when running something like ACE Showcase with Mojarra, the jsf.js file is loaded twice. The reason is that the h:commandLink components used on the page will render out an inline reference to the file if Mojarra determines it's necessary. You can see it in the CommandLinkRenderer class:


          @Override
          public void encodeBegin(FacesContext context, UIComponent component)
                throws IOException {

              rendererParamsNotNull(context, component);

              if (!shouldEncode(component)) {
                  return;
              }

              boolean componentDisabled =
                    Boolean.TRUE.equals(component.getAttributes().get("disabled"));

              String formClientId = RenderKitUtils.getFormClientId(component, context);

              if (componentDisabled || formClientId == null) {
                  renderAsDisabled(context, component);
              } else {
                  RenderKitUtils.renderJsfJs(context);
                  renderAsActive(context, component);
              }

          }

      In the method, it attempt to do a check to see if jsf.js is already there (which we do in the BridgeSetup) but it presumably fails that check and renders out an inline script for the benefit of the onclick handler:


      <li style="padding-left: 15px;">
          <script src="/mo/javax.faces.resource/jsf.js.jsf?ln=javax.faces&amp;stage=Development"
                type="text/javascript">
          </script>
          <a class="selected"
             href="#"
             id="j_idt20:j_idt22:24:j_idt30:0:_t32"
             onclick="mojarra.jsfcljs(document.getElementById('j_idt20'),{'j_idt20:j_idt22:24:j_idt30:0:_t32':'j_idt20:j_idt22:24:j_idt30:0:_t32'},'');return false"
             title="Overview">
              <span id="j_idt20:j_idt22:24:j_idt30:0:_t33">&gt; Overview</span>
          </a>
      </li>

        Activity

        Deryk Sinotte created issue -
        Hide
        Deryk Sinotte added a comment -

        Assigning to Mircea

        Show
        Deryk Sinotte added a comment - Assigning to Mircea
        Deryk Sinotte made changes -
        Field Original Value New Value
        Environment ICEfaces 3 ICEfaces 3 Mojarra
        Salesforce Case []
        Assignee Priority P2
        Assignee Mircea Toma [ mircea.toma ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #27106 Thu Jan 05 15:33:58 MST 2012 mircea.toma ICE-7619 Assign 'name' and 'library' attributes to JavascriptResourceOutput components as well to make sure JSF/Mojarra will detect that jsf.js was already added.
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/java/org/icefaces/impl/event/BridgeSetup.java
        Hide
        Mircea Toma added a comment -

        Changed JavascriptResourceOutput constructor to assign 'name' and 'library' attributes to the component so that JSF/Mojarra will detect when "jsf.js" component resource was already added.

        Show
        Mircea Toma added a comment - Changed JavascriptResourceOutput constructor to assign 'name' and 'library' attributes to the component so that JSF/Mojarra will detect when "jsf.js" component resource was already added.
        Mircea Toma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Deryk Sinotte
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: