Hi all

I'd like to use the Validation Framework outside of struts but I'm facing
some problems how to find out if the validation has faild or not after
calling the validate method of the Validator Class.
I tried to look how struts does it but did not succeed.

Does anybody know what to do after calling validate()? Below you can see how
I do it right know. But I have the feeling that I do things the validate
method already does.

Thanks a lot

Roland


Code snippet how I find out if any of the validation has vaild.

  protected ValidatorResults validate ( String validationFormName, Object
bean ) throws ValidatorException {
    ValidatorResults tValidatorResults = null;
    Validator validator = new Validator ( getValidatorResources (),
validationFormName );
    validator.addResource ( Validator.BEAN_KEY, bean );
    tValidatorResults = validator.validate ();

    boolean result = true;
    Iterator tIterResultValueMap = tValidatorResults.get();
    while ( tIterResultValueMap.hasNext() ){
      String tPropertieName = (String)tIterResultValueMap.next();
      Iterator tIterActionMap =
tValidatorResults.getValidatorResult(tPropertieName).getActionMap().keySet()
.iterator();
      while (tIterActionMap.hasNext()){
        String tValidatorActionName = ( String ) tIterActionMap.next();
        boolean tIsValid =
tValidatorResults.getValidatorResult(tPropertieName).isValid(tValidatorActio
nName);
        result = result && tIsValid;
      }
    }
    .....
    .....
    return tValidatorResults;
  }


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to