title: Struts 2 manually call a custom validation in an action
body: <p>We have used Struts 2 validation with lots of custom validation to validate our forms. </p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>@Validations( 
      customValidators =      
             { @CustomValidator(type = "AccountFormat", fieldName = "accountNo") }
  )
  </code></pre>
  
  <p>Also we can can manually validate a form by overriding the validate method</p>
  
  <pre class="lang-java prettyprint-override"><code>public void validate() {
      //Username can't be blank
      if(username.equals("")) {
          addFieldError("username", "The Username can't be empty");
      }
  </code></pre>
  
  <p>Is it possible to call the <code>custom validations</code> in the <code>validate()</code>.</p>
  
  <p><strong>Why we need it ?!</strong>
  All validation rules are packed in custom validations, which is perfect. There are some few forms which need to have their own manual validation. We end up cut and pasting some of custom validation rules in these manual validation forms too, it would be best if we could call validations here</p>