ICEfaces
  1. ICEfaces
  2. ICE-5397

SelectOne menu doesn't render properly with ICEfaces-2.0

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-Alpha2
    • Fix Version/s: 2.0-Alpha3, 2.0.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      jsf2.0, ICEfaces-2.0

      Description

      using basic-ajax example of redirection, the following does not render correctly when adding ICEfaces-2.0:-
      <h:body>
          <h1>Ajax Redirect</h1>
          <h:form id="form">
              <h:selectOneMenu valueChangeListener="#{redirectBean.redirectPage}">
                  <f:selectItem itemLabel="Pick One" noSelectionOption="true" />
                  <f:selectItem itemValue="/redirecttarget1.xhtml" itemLabel="Page 1"/>
                  <f:selectItem itemValue="/redirecttarget2.xhtml" itemLabel="Page 2"/>
                  <f:selectItem itemValue="/redirecttarget3.xhtml" itemLabel="Page 3"/>
                  <f:ajax/>
              </h:selectOneMenu>
          </h:form>
      </h:body>

      remove the <f:ajax/> for ICEfaces (not required), and this component still does not render markup correctly:-
      WITHOUT ICEFACES the markup is:-
      <form enctype="application/x-www-form-urlencoded" action="/basic-ajax/redirect.jsf" method="post" name="form" id="form">
      <input type="hidden" value="form" name="form"/>
      <select onchange="mojarra.ab(this,event,'valueChange',0,0)" size="1" name="form:j_idt7" id="form:j_idt7"> <option selected="selected" value="">Pick One</option>
      <option value="/redirecttarget1.xhtml">Page 1</option>
      <option value="/redirecttarget2.xhtml">Page 2</option>
      <option value="/redirecttarget3.xhtml">Page 3</option>
      </select><input type="hidden" autocomplete="off" value="-7374595938062284617:-4968993212789003275" id="javax.faces.ViewState" name="javax.faces.ViewState"/>
      </form>

      Adding ICEFACES-2.0 generates the following markup:-
      span id="selectionRedirect">
      <h1>ICEfaces Redirect</h1>
      <form id="form" name="form" method="post" enctype="application/x-www-form-urlencoded" action="/navigationLinks/redirect.jsf">
      <input type="hidden" value="form" name="form"/>
      <select id="form:selectionRedirectId" size="1" onchange="null" name="form:selectionRedirectId">
      <option one="" pick="" selected="true" value=""/>
      <option 1="" page="" value="/redirecttarget1.xhtml"/>
      <option 2="" page="" value="/redirecttarget2.xhtml"/>
      <option 3="" page="" value="/redirecttarget3.xhtml"/>
      </select>
      <input id="javax.faces.ViewState" type="hidden" autocomplete="off" value="109192987162155312:-8337909413678179354" name="javax.faces.ViewState"/>
      <input type="hidden" name="ice.window" value="1266425719994"/>
      </form>
      </span>
      <script type="text/javascript">
      1window.ice.window = 1266425719994;
      </script>
      <script type="text/javascript">
      1ice.push.register(['1266425719994'], ice.retrieveUpdate);
      </script>
      <input id="gwProxy" type="hidden"></input>
      <input id="jsProxy" type="hidden" onclick="jsCall();"/>
      <div id="refHTML"/>



        Activity

        Hide
        Ted Goddard added a comment -

        Incorrect rendering is confirmed.

        Show
        Ted Goddard added a comment - Incorrect rendering is confirmed.
        Hide
        Ted Goddard added a comment - - edited

        This code in

        ./jsf-ri/src/com/sun/faces/renderkit/html_basic/MenuRenderer.java

        appears to be the root cause (slightly edited for illustration here):

        FastStringWriter bufferedWriter = new FastStringWriter(128);
        context.setResponseWriter(writer.cloneWithWriter(bufferedWriter));
        int count = renderOptions(context, component, items);
        context.setResponseWriter(writer);
        ...
        writeDefaultSize(writer, count);
        ...
        writer.write(bufferedWriter.toString());

        This allows the Renderer to make a single pass through the data structure and determine the count during rendering. The "count" is then written prior to the actual item markup. An interesting application of D2D rendering would be to modify the count after the items had been rendered.

        Show
        Ted Goddard added a comment - - edited This code in ./jsf-ri/src/com/sun/faces/renderkit/html_basic/MenuRenderer.java appears to be the root cause (slightly edited for illustration here): FastStringWriter bufferedWriter = new FastStringWriter(128); context.setResponseWriter(writer.cloneWithWriter(bufferedWriter)); int count = renderOptions(context, component, items); context.setResponseWriter(writer); ... writeDefaultSize(writer, count); ... writer.write(bufferedWriter.toString()); This allows the Renderer to make a single pass through the data structure and determine the count during rendering. The "count" is then written prior to the actual item markup. An interesting application of D2D rendering would be to modify the count after the items had been rendered.
        Hide
        Ted Goddard added a comment -

        The MenuRenderer was cloning the ResponseWriter, which, in the case of DOMResponseWriter, returns a BasicResponseWriter. BasicResponseWriter.writeText() was not applying closeStartIfNecessary() and this resulted in the half-open option tag.

        Note that the dom diff cannot be applied effectively to blocks of text placed in the DOM by MenuRenderer.

        Show
        Ted Goddard added a comment - The MenuRenderer was cloning the ResponseWriter, which, in the case of DOMResponseWriter, returns a BasicResponseWriter. BasicResponseWriter.writeText() was not applying closeStartIfNecessary() and this resulted in the half-open option tag. Note that the dom diff cannot be applied effectively to blocks of text placed in the DOM by MenuRenderer.

          People

          • Assignee:
            Ted Goddard
            Reporter:
            Judy Guglielmin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: