title: Omnifaces validateBean: attach message to specific component
body: <p>I am using <a href="http://showcase.omnifaces.org/validators/validateBean" rel="nofollow">Omnifaces <code>&lt;o:validateBean /&gt;</code></a> to use JSR303 bean validation with a class level constraint.</p>
  
  <p>The whole thing works quite good. The validation message is displayed in a Primefaces <code>&lt;p:messages /&gt;</code> component. Now I wanted to know whether it is possible to narrow the error message to a more precise component (i. e. a <code>&lt;p:message /&gt;</code> tag on a specific element)? In the example below I want to direct the error message to the <code>&lt;p:message /&gt;</code> component with <code>id="id_msg_anniversary"</code> (or if that is possible, to both <code>id="id_msg_anniversary"</code> and <code>id="id_msg_wedding"</code>).</p>
  
  <p>One of my intention is to validate everything with bean validation and not to use <code>&lt;o:validateOrder /&gt;</code> or <code>&lt;o:validateMultiple /&gt;</code>.</p>
  
  <pre><code>@DayIsBeforeAnniversary
  @Entity
  public class Person implements Serializable
  {
      @Temporal(TemporalType.DATE)
      private Date weddingDay;
  
      @Temporal(TemporalType.DATE)
      private Date silverWeddingAnniversary;
      ...
  }
  </code></pre>
  
  
  
  <pre><code>&lt;p:messages id="id_messages" /&gt;
  
  &lt;h:outputLabel value="Wedding Day" /&gt;
  &lt;p:message id="id_msg_wedding" display="icon" for="id_wedding" /&gt;
  &lt;p:calendar 
      id="id_wedding" 
      value="#{personController.person.weddingDay}"&gt; &lt;br /&gt;
  
  &lt;h:outputLabel value="Silver Wedding Anniversary" /&gt;
  &lt;p:message id="id_msg_anniversary" display="icon" for="id_anniversary" /&gt;
  &lt;p:calendar 
      id="id_anniversary" 
      value="#{personController.person.silverWeddingAnniversary}" /&gt; &lt;br/&gt;
  
  &lt;p:commandButton 
      value="test" 
      action="#{personController.navigate()}" 
      update="@all"/&gt;
  
  &lt;o:validateBean value="#{personController.person}" /&gt;
  </code></pre>
  
  
  
  <pre><code>public class DayIsBeforeAnniversaryValidator implements ConstraintValidator&lt;DayIsBeforeAnniversary, Person&gt;
  {
      @Override
      public boolean isValid(Person person, ConstraintValidatorContext context)
      {
          return person == null
              || person.getWeddingDay() == null
              || person.getSilverWeddingAnniversary() == null
              || person.getWeddingDay().before(person.getSilverWeddingAnniversary());
      }
      ...
  }
  </code></pre>
  
  
  
  <pre><code>public @interface DayIsBeforeAnniversary { ... }
  </code></pre>
  
  <p>For clarification I could attach more code.</p>