3 Replies Latest reply on Jan 18, 2011 10:58 AM by Ilya Sorokoumov

    Two issues of JSF 2.0 are solved by RichFaces 4.0

    Ilya Sorokoumov Master

      Hi folks,

      Today I continued my evaluation of JSF 2.0 and RichFaces 4.0(Actully I was using the latest SNAPSHOT of RF). And I found two interesting things which I want to tell you. These things are problems in plain JSF 2.0 which were completely solved by using RF 4.0.

      I do not except a possibility that both problems are only my own misconceptions about JSF 2.0.

      The first problem:

      I had to call a server action with ajax. So at the begining I tried to do it like this(with f:ajax and a4j:ajax):

      <h:commandLink value="h_commandLink + f_ajax" action="#{testBean.doTest1}">

            <f:ajax execute="@form" render="internalPanel" event="click"/>

      </h:commandLink>

      <h:commandLink value="h_commandLink + a4j_ajax" action="#{testBean.doTest1}">

         <a4j:ajax execute="@form" render="internalPanel" event="click"/>

      </h:commandLink>

      <h:commandButton value="h_commandLink + f_ajax" action="#{testBean.doTest1}">

          <f:ajax execute="@form" render="internalPanel" event="click"/>

      </h:commandButton>

      <h:commandButton value="h_commandLink + a4j_ajax" action="#{testBean.doTest1}">

          <a4j:ajax execute="@form" render="internalPanel" event="click"/>

      </h:commandButton>

      But none of those variants were executing the action #{testBean.doTest1}. They only were re-rendering an element with ID internalPanel. Then I tried a4j:commandButton & a4j:commandLink in the folliwing way:

      <a4j:commandLink value="a4j_commandLink"

           action="#{testBean.doTest1}"

           execute="@form"

           render="internalPanel">

      </a4j:commandLink>

      <a4j:commandButton value="a4j_commandButton"

           action="#{testBean.doTest1}"

           execute="@form"

           render="internalPanel">

      </a4j:commandButton>

      They were working fine. So I'm glad that RF 4.0 solves this problem but I only want to know if I implemented something wrong with f:ajax and a4j:ajax.

      The second problem:

      I tried to re-render a couple elements with ajax and one of these elements was out of the form. But I suddenly found that f:ajax didn't work with the following expression:

      <f:ajax execute="@form" render=":externalPanel" event="click"/><!-- works fine -->

      <f:ajax execute="@form" render="internalPanel" event="click"/><!-- works fine -->

      <f:ajax execute="@form" render="internalPanel, :externalPanel" event="click"/><!--does not work -->

      But at the same time a4j components were working fine:

      <h:commandLink value="h_commandLink + a4j_ajax">

          <a4j:ajax execute="@form" render="internalPanel, :externalPanel" event="click">

          </a4j:ajax>

      </h:commandLink>

      <a4j:commandLink value="a4j_commandLink"

           action="#{testBean.doTest1}"

           execute="@form"

           render="internalPanel, :externalPanel">

      </a4j:commandLink>

      I also don't know why this's happening with f:ajax but I'm very glad now that I can solve some JSF 2.0 limitation by using of more convinient and powerful  RichFaces components.

       

      Regards,

      Ilya.

       

      P.S. At the begining I decided to write this in an article or like a post in my blog but then I decided that I should discuss these problems with you and only then if these problems with JSF 2.0 are approved as existed I will convert this discussion to something bigger.