title: Include field name in error messages generated by annotated validators in JSF
body: <p>It's very handy to use bean validation like <code>javax.validation.constraints.Size</code> in my Java code, such as:</p>
  
  <pre><code>@Size(min=1,max=30)protected String custName;
  </code></pre>
  
  <p>rather than the wordier equivalent embedded in the .xhtml page, such as:</p>
  
  <pre><code>&lt;f:validateLength minimum="1" maximum="30" /&gt;
  </code></pre>
  
  <p>The problem I'm having is that I'm not able to get the field name to appear in the error message.  I can customize the message by adding the following entry to ValidationMessages.properties in the root of my source directory:</p>
  
  <pre><code>javax.validation.constraints.Size.message={0} value is too long.
  </code></pre>
  
  <p>But no value gets substituted for {0}.  The upshot is that while the annotated validators work fine for simple pages where I can include a separate <code>&lt;p:message /&gt;</code> for each form field, they don't work so well for a more complex (e.g. tabbed) form where I need to group my messages at the top of the page.  Is there any workaround for this, or is my only reasonable choice to use the JSF validators?</p>