• Post Reply Bookmark Topic Watch Topic
  • New Topic

Apache commons validator, bean properties to validate should all be string?

Ali Pirzada
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

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?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!