Ah found it,
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = super.validate(mapping,request);
if ((file == null) || (file.getFileSize() < 1))
errors.add("file", new ActionError("error.nofile"));
return errors;
}
the validate method was overriden by the validate method in the form,
calling super.validate(mapping,request) solved the problem.
----- Original Message -----
From: "Ralph vd Houdt" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 30, 2001 9:42 AM
Subject: Validator & Input fields of type File
> 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
>
>
>
>