3 Replies Latest reply on Jun 16, 2009 9:29 AM by Ilya Shaikovsky

    rich:beanValidator width Double

    Benjelloun Mohamed Newbie

      Hi,
      Im using <rich:benaValidator> ,validation with annotation(org.hibernateValidator) in the managedBean.

      <h:inputText value="#{managedBean.number}" id="number" >
      <rich:beanValidator />
      </h:inputText>

      managedBean.java
      @NotEmpty(message="not empty.")
      @Digits(integerDigits=2,fractionalDigits=2,message="Should be a number ")
      private String number;

      like this,the validation works fine and i got a specific message that i write: --> Should be a number,

      but I want that a field in managedBean.java sould be Double,so when I put it to Double ,I got the following exception:
      java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.String
      at org.hibernate.validator.NotEmptyValidator.isValid(NotEmptyValidator.java:36)
      at org.hibernate.validator.ClassValidator.getPotentialInvalidValues(ClassValidator.java:478)
      at org.richfaces.validator.HibernateValidator.validateClass(HibernateValidator.java:96)
      at org.richfaces.validator.HibernateValidator.validateBean(HibernateValidator.java:162)
      at org.richfaces.validator.HibernateValidator.validate(HibernateValidator.java:137)
      at org.richfaces.validator.ObjectValidator$ValidationResolver.setValue(ObjectValidator.java:411)