1 Reply Latest reply on Apr 4, 2008 2:16 PM by Sergey Smirnov

    a4j:support with immediate=true disables bean updates in 3.2

    Mike Hanafey Newbie

      In the example below, for the cases where immediate="true" no AJAX update of the outputText field occurs with 3.2.0.GA. The AJAX request happens, but the backing bean is not updated, and so the AJAX reRendered area does not change.

      This behaviour is different from 3.1.4.GA, where immediate="true" on a4j:support has no effect on the update phase of the enclosing component.

      <h:form id="dialog">
       Enter text. It should also update the output area with immediate:
       <h:inputText id="oneA" value="#{bean.name}" size="8">
       <a4j:support event="onkeyup" reRender="three" immediate="true" focus="oneA" action="#{bean.actionOne}"/>
       </h:inputText>
      
       <br/>
      
       Enter text. It should also update the output area without immediate:
       <h:inputText id="oneB" value="#{bean.name}" size="8">
       <a4j:support event="onkeyup" reRender="three" immediate="false" focus="oneB" action="#{bean.actionOne}"/>
       </h:inputText>
      
       <br/>
      
       Changing the checkbox should be reflected in output area with immediate:
       <h:selectBooleanCheckbox id="twoA" value="#{bean.option}">
       <a4j:support event="onclick" reRender="three" immediate="true" focus="twoA" action="#{bean.actionOne}"/>
       </h:selectBooleanCheckbox>
      
       <br/>
      
       Changing the checkbox should be reflected in output area without immediate:
       <h:selectBooleanCheckbox id="twoB" value="#{bean.option}">
       <a4j:support event="onclick" reRender="three" immediate="false" focus="twoB" action="#{bean.actionOne}"/>
       </h:selectBooleanCheckbox>
      
       <br/>
      
       <h:commandButton id="go" value="Submit"/>
      </h:form>
      
      <h:outputText id="three" value="#{bean.name} #{bean.option}"/>


        • 1. Re: a4j:support with immediate=true disables bean updates in
          Sergey Smirnov Master

          So, immediate works exactly like it should according to JSF 1.2 spec.

          Yes, it was a problem in 3.1.4. We could not use the standard JSF API as soon as we had to support not only JSF 1.2, but JSF 1.1 as well. So, instead of using standard API, we used own hack that emulated the behavior. The used approach had some side effect (undocumented feature) that you used to use with 3.1.4. Now, this side effect is gone.

          Sorry, but we are not willing to return it back because:
          1. it is impossible with standard JSF 1.2 API
          2. it is against the JSF 1.2 spec

          Good news:
          RichFaces has 'process' attribute that allows to point to other component that should processed together with command component marked like ajaxSingle (ajaxSingle is the same as immediate=true from the behavior point of view)

          So, if understand what you want to do, you need to:
          1. replace immediate with ajaxSingle
          2. add 'process' attribute to each next call (as an attribute of a4j:support) that point to the above component should be processed.


          P.S. process attribute has two limitations:
          1. it works only if ajaxSingle="true" is defined for given command component
          2. you do not have to point to one of the own parent components to avoid processing of command component twice.