commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <simonetrip...@apache.org>
Subject Re: Apache commons validator, bean properties to validate should all be string?
Date Mon, 20 Aug 2012 13:59:37 GMT
I would suggest you to have a look at Apache BVal[1] for Bean
Validation - it is a JSR303 implementation - that sounds more
appropriate for your use case.

HTH,
-Simo

[1] http://bval.apache.org/

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/


On Mon, Aug 20, 2012 at 3:41 AM, pirzada rashid
<pirzada.rashid@gmail.com> wrote:
> Anyone please help
>
> On Fri, Aug 17, 2012 at 7:05 PM, pirzada rashid <pirzada.rashid@gmail.com>wrote:
>
>> I was working on apache commons validator latest. Problem explained below.
>>
>> My Bean is having 2 properties fullName (String) & age (int). Validation
>> "required" on both but age needed to be checked for "integer" as well.
>>
>> bean.setFullName("Tester"); -----> Will Pass
>>
>> bean.setAge("Too Old"); ---> "required Pass but "integer" Fail.
>>
>> results = validator.validate();
>>
>> *Note:* Above is possible if age property is String but its not and
>> setAge won't accept String value and throw exception before reaching
>> validator.validate().
>>
>> Validation should be checked before we set the bean. In above situation I
>> need to make all properties string than in validation.xml check for
>> integer/condition.
>>
>> *How I work with this when my age property is Integer. little confused?*
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message