Results 1 to 1 of 1
- 08-20-2012, 04:11 AM #1
Member
- Join Date
- Aug 2012
- Posts
- 1
- Rep Power
- 0
Apache commons validator, bean properties to validate should all be string?
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. Handle bean with date, integer etc?
Similar Threads
-
javax.servlet.jsp.JspException: Cannot find bean org.apache.struts.taglib.html.BEAN i
By gurpreet.singh in forum Advanced JavaReplies: 1Last Post: 03-23-2011, 07:55 AM -
Validator.validate() fails when using DOM Document instead of File
By msucena in forum XMLReplies: 4Last Post: 11-04-2010, 02:41 PM -
[SOLVED] Apache Commons Properties file exceptions
By edwardmluk in forum Java ServletReplies: 1Last Post: 03-06-2009, 04:24 PM -
Commons validator
By aczuczor in forum Web FrameworksReplies: 0Last Post: 07-27-2007, 08:46 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks