title: Struts2 Validation using XML not working?
body: <p>I'm trying to use Struts2 validation using XML to check various fields entered by Customer. My <code>struts.xml</code> extends <code>struts-default</code>, and I have a extremely simple action class <code>TestAction</code> which extends <code>ActionSupport</code>, but it is not working. </p>
  
  <p>If anyone is able to help me see what I lack, I would be extremely grateful. </p>
  
  <p>Here's what I have:</p>
  
  <p><strong>CustomerAction-validation.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
    &lt;!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"&gt;
  &lt;validators&gt;
      &lt;field name="customerName"&gt;
          &lt;field-validator type="requiredstring"&gt;
              &lt;message&gt;Required&lt;/message&gt;
          &lt;/field-validator&gt;
      &lt;/field&gt;
  &lt;/validators&gt;
  </code></pre>
  
  <p><strong>struts.xml</strong></p>
  
  <pre><code>&lt;action name="addCustomer" class="com.yell.hibu.action.CustomerAction"
              method="execute"&gt;
              &lt;interceptor-ref name="validation"/&gt; 
               &lt;param name="excludeMethods"&gt;  
                      input,back,cancel,browse  
                  &lt;/param&gt;
              &lt;interceptor-ref name="fileUpload"&gt;
                  &lt;param name="maximumSize"&gt;2097152&lt;/param&gt;
                  &lt;param name="allowedTypes"&gt;
                      image/png,image/gif,image/jpeg,image/pjpeg
                  &lt;/param&gt;
              &lt;/interceptor-ref&gt;
              &lt;interceptor-ref name="defaultStack"&gt;&lt;/interceptor-ref&gt;
              &lt;result name="success"&gt;/success.jsp&lt;/result&gt;
              &lt;result name="input"&gt;/registration.jsp&lt;/result&gt;
          &lt;/action&gt;
  </code></pre>
  
  <p>Here I have Registration.jsp for only 1 field</p>
  
  <pre><code>&lt;s:form action="addCustomer" id="register-form" method="post"  validate="true" theme="xhtml" enctype="multipart/form-data"&gt;
  &lt;s:actionerror/&gt;
  &lt;s:fielderror/&gt;
  &lt;s:textfield name="customer.customerName" label="Customer Name:" cssClass="tooltip"  title="Max 10 characters allowed." maxlength="10"/&gt;
  </code></pre>
  
  <p></p>