The moose likes Other Open Source Projects and the fly likes Apache Commons Validation Framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Apache Commons Validation Framework" Watch "Apache Commons Validation Framework" New topic

Apache Commons Validation Framework

Ajay Dhar
Ranch Hand

Joined: Jan 26, 2011
Posts: 30
I am implementing a validation framework based on the Apache Commons Validation Framework. I am using this framework in conjunction with JSF. The program flow is the following. Data is populated in a Web form and the user clicks the submit button. The fields of the form are bound to a managed bean. An action method linked to the submit button executes and passes the managed bean to the Apache validator. The issue that I'm running into is that the validator requires that the data in the managed bean that's being passed in be a String. I would like to store data in the managed bean not as strings, but as integers, longs, floats, etc. The question is, if the managed bean stores data other than String type, how do I get the Apache validator to validate it. Note that I have the code for the Apache validator so if I knew how to modify the code I can.

I don't have the option of using the JSF validation framework (which allows the bean to have data other than string).

OCPJP 6, OCEEJBD 6, GIAC Secure Software Programmer-Java (GSSP-Java)
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

I can't help you as I'm not using that library, but I think that you might be misunderstanding the usage of that library. There are a bunch of validators which accepts many different kind of types, not only Strings.

[My Blog]
All roads lead to JavaRanch
I agree. Here's the link:
subject: Apache Commons Validation Framework
It's not a secret anymore!