4 Replies Latest reply on Sep 13, 2010 2:50 AM by nimo stephan

    possible bug in jsf 2.0.2

    nimo stephan Master

      I found a strange thing in jsf 2:

       

       

      THIS WORKS:

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
           xmlns:h="http://java.sun.com/jsf/html"
           xmlns:f="http://java.sun.com/jsf/core"
           xmlns:ui="http://java.sun.com/jsf/facelets">

       

      <h:head>
           <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      </h:head>


      <h:body>

       

      <h:form>
            <h:commandButton value="make" action="#{bean.make}">
                    <f:ajax render=":grid"/>
             </h:commandButton>
      </h:form>

       


      <h:panelGrid id="grid">
               <h:outputText value="#{bean.makeValue}" />
      </h:panelGrid>

       

      </h:body>

      </html>

       

       

       

      THIS DOES NOT WORK:

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:ui="http://java.sun.com/jsf/facelets">

       

      <h:head>
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      </h:head>


      <h:body>

       

      <h:form>
           <h:commandButton value="make" action="#{bean.make}">
                   <f:ajax render=":grid"/>
            </h:commandButton>
      </h:form>

       

      <!-- this is the only difference -  in this version, I am using a div instead of a jsf-component (h:panelGrid)-->
      <div id="grid">
              <h:outputText value="#{bean.makeValue}" />
      </div>

       

      </h:body>

       

      </html>

       

      I get this error:

       

      <f:ajax> contains an unknown id ':grid' - cannot locate it in the context of the component myCommand.

       

       

      I looked at my component tree provided from the error-page and find my id which is purly called "grid".

      So the id "grid" still exists. But f:ajax cannot find it.

       

      The strange thing is,

      when substituting <div id="grid"></div> with <h:panelGrid id="grid"></h:panelGrid> then it is working - f:ajax can find "grid" and makes a update.

       

      So my question:

       

      Does f:ajax works only with jsf-components? Is this a bug? I use jsf-version "jsf-api-2.0.2-FCS.jar.