title: how to validate date format in struts2
body: <p>i am trying to warn the user when he entered a date in other than (DD-MON-YYYY) format</p>
  
  <p>The problem i am facing is i have used xml validation to validate my jsp.
  when i googled it we have only checking for date range in struts2 xml validation.
  this is my jsp.</p>
  
  <pre><code>&lt;s:form action="capturePolicyPrgm"&gt;
      &lt;s:div class="table"&gt;
          &lt;s:textfield name="clientNo" label="CLIENT NUMBER" size="20"  /&gt;                    
          &lt;s:textfield name="lifewardsCard" label="LIFE WARDS CARD NUMBER" size="20"/&gt;                    
          &lt;s:textfield name="policyCode" label="REFERRING POLICY NO" size="20"/&gt;
          &lt;s:select name="companyName" label="COMPANY"
              list="{'BIHL','BLIL','BIFM','LG','LEA'}" /&gt; 
          &lt;s:textfield name="doc" label="INCEPTION DATE" size="20"/&gt;
          &lt;s:select name="product" label="COVER ID"
              list="{'Card Holder','Spouse','Child 22-25 Yrs','Child 16-21 Yrs','Child 6-15 Yrs','Child 0-5(incl.Stillborn)'}" /&gt;             
          &lt;s:textfield name="expiryDate" label="TERMINATION DATE" /&gt;
          &lt;s:textfield name="premium" label="PREMIUM" /&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;s:submit value="submit" theme="simple" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;s:submit type="button" theme="simple" onclick="clear();return false;"
                      value="clear" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/s:div&gt;
  &lt;/s:form&gt;
  </code></pre>
  
  <p>here's my xml validation</p>
  
  <pre><code>&lt;!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
     "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"&gt;
   &lt;validators&gt;
    &lt;field name="lifewardsCard"&gt;
      &lt;field-validator type="requiredstring"&gt;
      &lt;param name="minLength"&gt;16&lt;/param&gt;
      &lt;param name="maxLength"&gt;16&lt;/param&gt;
          &lt;message&gt;Card number is required and must be of length 16&lt;/message&gt;
      &lt;/field-validator&gt;
  &lt;/field&gt;    
  &lt;field name="policyCode"&gt;
      &lt;field-validator type="requiredstring"&gt;
          &lt;message&gt;Please enter referring Policy No.&lt;/message&gt;
      &lt;/field-validator&gt;
  &lt;/field&gt;
  &lt;field name="doc"&gt;
      &lt;field-validator type="requiredstring"&gt;
          &lt;message&gt;Please Enter Policy Commencement Date.&lt;/message&gt;
      &lt;/field-validator&gt;
  &lt;/field&gt;    
  &lt;field name="expiryDate"&gt;
      &lt;field-validator type="requiredstring"&gt;
          &lt;message&gt;Please Enter Policy Expiry Date.&lt;/message&gt;
      &lt;/field-validator&gt;
  &lt;/field&gt;
  </code></pre>
  
  <p>
  my action class is implementing modeldriven interface.
  please help on how can i validate this using xml.</p>