title: JSF AJAX validation: execute="@this" render="@form" inconsistent depending on prior requests
body: <p>I have an <code>h:commandLink</code> that calls a method that changes a property bound to a radio  input.</p>
  
  <p>I also have a text input on the same form with some validation (required=true).</p>
  
  <p>If I leave the text input blank, and click on <code>h:commandLink</code> with <code>execute="@this</code>, the radio button updates from the model property as expected, because the text input is never processed and validation never fires.</p>
  
  <p>However, if first I click on a different <code>h:commandLink</code> with <code>execute="@form"</code>, <em>then</em> the link with <code>execute="@this"</code>, the validation messages go away but the radio button value does <em>not</em> update from the model even though the UIInput for the radio button was never in an invalid state.</p>
  
  <p>I'm finding it annoying that the <code>execute="@this"</code> behaves differently depending on what I had done previously, when my intent with <code>@this</code> was to force everything to update from the model and ignore any submitted values from the components.  </p>
  
  <p>I suspect what's happening is something like this:</p>
  
  <ul>
  <li>with <code>@form</code>, radio button and text are both processed. </li>
  <li>Radio button is valid so <code>localValue</code> is set</li>
  <li>Process validations phase fails overall because of invalid text input, so <code>localValue</code> remains set and does not get cleared or propagate to <code>value</code></li>
  <li>the only way out of this is to explicitly call <code>resetValue()</code> or to re-process the component in question (e.g., <code>execute="@this radio"</code>) to clear out <code>localValue</code> and then allow refreshing from bean.</li>
  </ul>
  
  <p>My questions are:</p>
  
  <ul>
  <li>is my understanding of the lifecycle correct?</li>
  <li>Am I doing something wrong, or is this one of the annoying-by design things about JSF? </li>
  </ul>
  
  <p>It feels like this may just be another example of this question</p>
  
  <p><a href="https://stackoverflow.com/questions/6642242/how-can-i-populate-a-text-field-using-primefaces-ajax-after-validation-errors-oc">How can I populate a text field using PrimeFaces AJAX after validation errors occur?</a></p>
  
  <p>Unfortunately I feel like I'm finding lots of those lately. :-(</p>
  
  <p>Code example below:</p>
  
  <pre><code>&lt;h:form&gt;
  &lt;h:messages/&gt;
  
  Radio = 
  &lt;h:selectOneRadio value="#{testBean.radioValue}" id="radio" binding="#{radio}"&gt;
      &lt;f:selectItem itemValue="foo" itemLabel="Foo"/&gt;
      &lt;f:selectItem itemValue="bar" itemLabel="Bar"/&gt;
  &lt;/h:selectOneRadio&gt;
  
  &lt;br&gt;&lt;/br&gt;
  radio bean value = &lt;h:outputText value="#{testBean.radioValue}"/&gt;
  &lt;br&gt;&lt;/br&gt;
  radio UIInput localValue = &lt;h:outputText value="#{radio.localValue}"/&gt;
  &lt;br&gt;&lt;/br&gt;
  radio UIInput value = &lt;h:outputText value="#{radio.value}"/&gt;
  
  &lt;br&gt;&lt;/br&gt;
  
  String w/validation = &lt;h:inputText value="#{testBean.stringValue}" required="true" /&gt;
  
  &lt;br&gt;&lt;/br&gt;
  
  &lt;ul&gt;
  &lt;li&gt;
  &lt;h:commandLink actionListener="#{testBean.changeRadioValue}" value="execute = @form"&gt;
      &lt;f:ajax render="@form" execute="@form"/&gt;
  &lt;/h:commandLink&gt;
  &lt;/li&gt;
  
  &lt;li&gt;
  &lt;h:commandLink actionListener="#{testBean.changeRadioValue}" value="execute = @this"&gt;
      &lt;f:ajax render="@form" execute="@this"/&gt;
  &lt;/h:commandLink&gt;
  &lt;/li&gt;
  
      &lt;li&gt;
  &lt;h:commandLink actionListener="#{testBean.changeRadioValue}" value="execute = @this radio"&gt;
      &lt;f:ajax render="@form" execute="@this radio"/&gt;
  &lt;/h:commandLink&gt;
  &lt;/li&gt;   
  &lt;/ul&gt;
  
  &lt;/h:form&gt;
  </code></pre>
  
  <p>And this bean:</p>
  
  <pre><code>@ManagedBean
  @ViewScoped
  public class TestBean {
  
  private String radioValue = "foo";
  private String stringValue;
  
  public void changeRadioValue() {
      radioValue = "bar";
  }
   // + getters/setters
   }
  </code></pre>