0 Replies Latest reply on Mar 1, 2012 11:56 AM by Yevgen Bushuyev

    @Size validation sample

    Yevgen Bushuyev Newbie

      Hi,

      Is it possible to use @org.hibernate.validator.Size put on a class member which is displayed with some UIDataAdaptorBase ancestor (table, dataList) ?

       

      My sample:

       

      public class Customer {

           ....

          @NotNull

          @Length(max=35)

          private String firstName;

       

       

          @NotNull

          @Size(min=1)

          private List<Address> addresses = new ArrayList<Address>();

          ....

       

      }

       

      it's displayed with

       

      <h:form id="customerForm">

         <s:validateAll>

           ....

           <h:inputField value="#{customer.firstName}"/>

          ....

            <rich:dataTable id="addresses" value="#{customer.addresses}" var="address">

                 ....

            </rich:dataTable>

        </s:validateAll>

      </h:form>

       

      I want to ensure that there is at least one address in a customer. As far as I can understand in UIDataAdaptorBase it only calls its childrens' validators thus @Size annotation has no effect. Also I can't find any sample with that @Size neither in seam nor on the web.

       

      Any help is highly appreciated