title: How to validate an empty field in action method?
body: <p>I have an input field and a button. I want to check if the <code>textinput</code> is valid before executing the button action. If it is valid I will render a response message. I have a code like this:</p>
  
  <pre><code>public void submitReportRequest() {
      if(nameField!=null){
          System.out.println("aaaaaaaaaaaaa");
          submitted=true;
      }
      if(nameField == null){
          System.out.println("report name is null!!!!!!");
      }
  }
  </code></pre>
  
  <p>but from the console I just get:</p>
  
  <pre><code>[#|2011-11-18T15:22:49.931+0200|INFO|glassfishv3.0|null|_ThreadID=21;_ThreadName=Thread-1;|aaaaaaaaaaaaa|#]
  </code></pre>
  
  <p>when the <code>nameField</code> is empty, I receive nothing in the console just page is re-rendered with the validation message of <code>nameField</code>. I know from the JSF life cycle if the validation phase fails then it jumps directly to the render response phase and button action is never reached. But how can I achieve my objective in this case?</p>