2 Replies Latest reply on Sep 6, 2010 2:54 AM by nimo stephan

    ajax in jsf 2 does only for jsf-tags ?

    nimo stephan Master

      why does jsf 2.0 ajax does not recognize client-side tags?

       

      For example, this works:

       

      <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>

       

       

       

      while this is not working (because I use the tag html-tag <div> instead of a jsf-tag):

       

      <h:form>

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

       

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

       

       

      With RF 3 a4j:reRender-Tag, this was not a problem!

        • 1. Re: ajax in jsf 2 does only for jsf-tags ?
          Nick Belaevski Master

          Hi Nimo,

           

          Can you please recheck if this:

           

          <h:form>

               <h:commandButton value="make" action="#{bean.make}">
                       <a4j:support reRender=":grid"/>
                </h:commandButton>
          </h:form>

           

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

           

          is working in 3.x? Maybe you had "jsfc" attribute on div element when you tested that?

          • 2. Re: ajax in jsf 2 does only for jsf-tags ?
            nimo stephan Master

            Hi Nick,

             

            it works with rf 3 and a4j:support.

             

            However, actually I have a pure jsf2-project (without rf or other jsf-libs). ReRender is not working when using (jsf-2.0-tag) f:ajax and div:

             

            <h:form>

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

             

            <!-- f:ajax does not recognize a div, hence no ajax-update happens -->

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

             

             

            however, this works:

             

             

            <h:form>

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

             

            <!-- f:ajax does recognize jsf-tag h:panelGrid, hence ajax-update is working -->

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