commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pirzada rashid <>
Subject Apache commons validator, bean properties to validate should all be string?
Date Fri, 17 Aug 2012 14:05:21 GMT
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

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

*How I work with this when my age property is Integer. little confused?*

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message