Hi All,

I'm using the Struts Validator bij David Winterfeldt. An excelent addition
to the struts framework. A little problem arises when I tryed to validate an
upload field of a form. The "required" setting of the validator doesn't work
for inputfields with files. I try to validate the other fields first with
the Validator and then use the validate method in the form to check the
input field of the file. I used the following code.

    public ActionErrors validate(ActionMapping mapping,
                                 HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if ((file == null) || (file.getFileSize() < 1))
            errors.add("file", new ActionError("error.nofile"));
        return errors;
    }

The problem is that the "new ActionErrors()" empties the errors found bij
the Validator. Is there a function to retrieve the ActionErrors of the
Validator to be used in the rest of the validate method for example:

    ActionErrors errors = this.getActionErrors();

Or a method to check files in the Validator.

Greeting Ralph


Reply via email to