title: Value remains in form field after it is cleared in bean in JSF2
body: <p>In my JSF2 application, I have "Clear" button, which is supposed to clear all the fields. However, it doesn't always work.</p>
  
  <p>My page fragment:</p>
  
  <pre><code>&lt;h:form id="bi"&gt;
    &lt;h:inputText value="#{bean.entity.firstname}" /&gt;
    &lt;h:inputText value="#{bean.entity.surname}" /&gt;
  
    &lt;h:commandButton value="Clear" immediate="true" action="#{bean.clear}"&gt;
      &lt;f:ajax render="bi" /&gt;
    &lt;/h:commandButton&gt;
    &lt;h:commandButton value="Submit" action="#{bean.submit}" /&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>And <code>clear()</code> method in my bean:</p>
  
  <pre><code>public void clear() {
    entity = new Entity();
  }
  </code></pre>
  
  <p>If I enter values in the fields, and click "Clear", everything is cleared as expected. However, consider such scenario:
  1. Enter value only in one field (both are required by JSR303 annotations on entity).
  2. Click "Submit". Error message appears.
  3. Click "Clear".</p>
  
  <p>Entered value remains. Why is it not cleared? </p>
  
  <p>Moreover, if I clear it by hand, and click "Clear", it returns to the field. I checked that it comes to the browser in partial response  after clicking "Clear" button. I suspect it has something to do with view state.</p>
  
  <p>Moreover, if I add <code>validator="#{bean.validate}"</code> to the field, it enter this validation. Even if button has <code>immediate="true"</code> attribute. Why? Shouldn't immediate button ommit validation?</p>