commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Validator] standalone
Date Fri, 07 Nov 2003 09:08:05 GMT


I'm trying to plug commons validator.
I didn't manage to find an example of commons-validator standalone.
I have some problems, can anyone help me?

Here is what I try

       try {
            _resources = ValidatorResourcesInitializer.initialize
        } catch (IOException e) {

        _validator = new Validator(_resources, "ExampleForm");

       ExampleForm myForm;
       myForm = new ExampleForm();

        _validator.addResource(Validator.BEAN_KEY, myForm);

        // Get results of the validation.
        Map hResults = null;

        try {
            hResults = _validator.validate().getResultValueMap();
        } catch (ValidatorException e) {
        if (hResults.get("firstName") == null) {
            // no error
        } else {
            // number of errors for first name     int errors = ((Integer)hResults.get("firstName")).intValue();

And I get this error :
7 nov. 2003 09:42:54 org.apache.commons.validator.Validator validateFieldForRule
FATAL: reflection: null
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(
      at java.lang.reflect.Method.invoke(
      at org.apache.commons.validator.Validator.validateFieldForRule(
      at org.apache.commons.validator.Validator.validateField(
      at org.apache.commons.validator.Validator.validate(
      at main.Example.InitValidator(

This message and any attachments (the "message") is intended solely for the addressees and
is confidential. 
If you receive this message in error, please delete it and immediately notify the sender.
Any use not in accord with 
its purpose, any dissemination or disclosure, either whole or partial, is prohibited except
formal approval. 
The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries)
shall (will) not 
therefore be liable for the message if modified. 


Ce message et toutes les pieces jointes (ci-apres le "message") sont etablis a l'intention
exclusive de ses 
destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le detruire
et d'en avertir 
immediatement l'expediteur. Toute utilisation de ce message non conforme a sa destination,
toute diffusion 
ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L'internet
ne permettant pas 
d'assurer l'integrite de ce message, BNP PARIBAS (et ses filiales) decline(nt) toute responsabilite
au titre de ce 
message, dans l'hypothese ou il aurait ete modifie.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message