Hey!

As it is mentioned in the subject I wonder if there is any possibility to
check file existence. 
I got this code on my jsp page:

[code]

<tr:inputFile 
   required="true"
   rendered="true" 
   label="Load File:"
   value="#{backingBean.file}"
 />     
<af:commandButton
    text="#{"Button"}"
    action="#{backingBean.importFile}" />     

[/code]

which bind the value to the file property. The type of file is UploadFile.
In backingBean I have this code:

[code]

UploadFile file;

public void importFile(){
        if(file != null) {
                doSomeAction();         
        }
        else{
                returnError();
        }
}

public UploadedFile getFile() {
                return file;
        }

public void setFile(UploadedFile file) {
                this.file = file;
}

[/code]

The point of the problem is that the file is never null, no matter if file
exists or not. If file doesn't exist the InputFile component doesn't return
null. The UploadFile doesn't have a method to check file existence. 
So my question is when file property can be null. And how to check if file
exists using InputFile component and UploadFile object? (I cannot use other
type, but UploadFile).

Reply via email to