title: JSF validate on submit form
body: <p>I'm working on a JSF 2.0 form, I have a managedbean with 2 fields</p>
  
  <pre><code>import java.util.Date;
  
  import javax.faces.bean.ManagedBean;
  import javax.faces.bean.RequestScoped;
  
  @ManagedBean
  @RequestScoped
  public class StackOverflow {
  
      private Date firstDate;
      private Date secondDate;
  
      public void submit(){
         //validate here and show error on form
      }
  
  }
  </code></pre>
  
  <p>and the xhtml like:</p>
  
  <pre><code>&lt;h:inputText value="#{stackOverflow.firstDate}"&gt;
      &lt;f:convertDateTime pattern="d/M/yyyy" /&gt;
  &lt;/h:inputText&gt;
  &lt;h:inputText value="#{stackOverflow.secondDate}"&gt;
      &lt;f:convertDateTime pattern="d/M/yyyy" /&gt;
  &lt;/h:inputText&gt;
  
  &lt;h:commandLink action="#{stackOverflow.submit}"&gt;
      &lt;span&gt;Submit&lt;/span&gt;
  &lt;/h:commandLink&gt;
  </code></pre>
  
  <p>I want to validate the first and second date that the second date is not before the first date</p>