title: JSF resetting form after submit
body: <p>i have a small problem with my jsf form. i made an example registration 
  form with a submit button and a reset button:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:ui="http://java.sun.com/jsf/facelets"&gt;
  
  &lt;h:head&gt;
      &lt;title&gt;Register&lt;/title&gt;
  &lt;/h:head&gt;
  
  &lt;h:body&gt;
  
      &lt;ui:composition template="/templates/master.xhtml" &gt;
  
          &lt;ui:define name="content"&gt;
  
              &lt;center&gt;
                  &lt;h:outputText value="New User Registration" /&gt;
              &lt;/center&gt;
  
              &lt;h:form&gt;
  
                  &lt;h:panelGrid columns="3"&gt;
  
                      &lt;h:outputText value="Username:" /&gt;
                      &lt;h:inputText id="username" value="#{registerService.userName}" required="true" requiredMessage="Please Enter Username!" /&gt;
                      &lt;h:message for="username" style="color:red" /&gt;
  
                      &lt;h:outputText value="Password:" /&gt;
                      &lt;h:inputSecret id="password" value="#{registerService.password}" required="true" requiredMessage="Please Enter Password!" /&gt;
                      &lt;h:message for="password" style="color:red" /&gt;  
  
                      &lt;h:outputText value="Confirm Password:" /&gt;
                      &lt;h:inputSecret id="confirmPassword" value="#{registerService.confirmPassword}" required="true" requiredMessage="Please Confirm Password!" /&gt;
                      &lt;h:message for="confirmPassword" style="color:red" /&gt;   
  
                      &lt;h:outputText value="Lastname:" /&gt;
                      &lt;h:inputText id="lastname" value="#{registerService.lastName}" required="true" requiredMessage="Please Enter Lastname!" /&gt;
                      &lt;h:message for="lastname" style="color:red" /&gt;
  
                      &lt;h:outputText value="Firstname:" /&gt;
                      &lt;h:inputText id="firstname" value="#{registerService.firstName}" required="true" requiredMessage="Please Enter Firstname!" /&gt;
                      &lt;h:message for="firstname" style="color:red" /&gt;
  
                      &lt;h:outputText value="Date of Birth" /&gt;
                      &lt;h:panelGrid columns="3"&gt;
  
                          &lt;h:selectOneMenu value="#{registerService.dayOfBirth}"&gt;
                              &lt;f:selectItems value="#{registerService.days}" /&gt;
                          &lt;/h:selectOneMenu&gt;
  
                          &lt;h:selectOneMenu value="#{registerService.monthOfBirth}"&gt;
                              &lt;f:selectItems value="#{registerService.months}" /&gt;
                          &lt;/h:selectOneMenu&gt;
  
                          &lt;h:selectOneMenu value="#{registerService.yearOfBirth}"&gt;
                              &lt;f:selectItems value="#{registerService.years}" /&gt;
                          &lt;/h:selectOneMenu&gt;
  
                      &lt;/h:panelGrid&gt;
                      &lt;h:outputText value="" /&gt;
  
                      &lt;h:outputText value="E-Mail:" /&gt;
                      &lt;h:inputText id="email" value="#{registerService.eMail}" required="true" requiredMessage="Please Enter E-Mail!" /&gt;
                      &lt;h:message for="email" style="color:red" /&gt; 
  
                      &lt;h:outputText value="Confirm E-Mail:" /&gt;
                      &lt;h:inputText id="confirmEmail" value="#{registerService.confirmEMail}" required="true" requiredMessage="Please Confirm E-Mail!" /&gt;
                      &lt;h:message for="confirmEmail" style="color:red" /&gt;  
  
                      &lt;h:outputText value="Country:" /&gt;
                      &lt;h:inputText id="country" value="#{registerService.country}" required="true" requiredMessage="Please Enter Country!" /&gt;
                      &lt;h:message for="country" style="color:red" /&gt;
  
                      &lt;h:outputText value="Region:" /&gt;
                      &lt;h:inputText id="region" value="#{registerService.region}" required="true" requiredMessage="Please Enter Region!" /&gt;
                      &lt;h:message for="region" style="color:red" /&gt;
  
                      &lt;h:outputText value="Town:" /&gt;
                      &lt;h:inputText id="town" value="#{registerService.town}" required="true" requiredMessage="Please Enter Town!" /&gt;
                      &lt;h:message for="town" style="color:red" /&gt;
  
                      &lt;h:outputText value="ZIP-Code:" /&gt;
                      &lt;h:inputText id="zipCode" value="#{registerService.zipCode}" required="true" requiredMessage="Please Enter ZIP-Code!" /&gt;
                      &lt;h:message for="zipCode" style="color:red" /&gt;   
  
                  &lt;/h:panelGrid&gt;
  
                  &lt;h:commandButton type="submit" value="Submit" action="#{registerService.addUser}" &gt;
                      &lt;f:ajax execute="@form" render="@form" /&gt;
                  &lt;/h:commandButton&gt;            
                  &lt;h:commandButton type="reset" value="Reset" /&gt;
  
              &lt;/h:form&gt;
  
          &lt;/ui:define&gt;
  
      &lt;/ui:composition&gt;
  
  &lt;/h:body&gt;
  </code></pre>
  
  <p></p>
  
  <p>When i type in something and press the reset button everything is reset (to empty)
  again. however when i just type in the username for example and press submit my
  error messages are appearing (required messages) as it should be and if i now
  press the reset button nothing is reset. everything stays the same.</p>
  
  <p>i want my reset button to work in every state. how can i do that?</p>