Hi,
it seems to me, that the required attribute of h:inputFile is not working. The reason is, that there is always an instance of javax.servlet.http.Part in submitted value and there should be something like part.getSize() <= 0 in getConvertedValue() or maybe overriden isEmpty method of UIInput class where is basic types emptiness check.

You can repeat that problem just on a simple form with h:inputFile, with required="true" without any validator.

    <h:form id="inputForm" enctype="multipart/form-data">

       <!-- inputFile tag to upload file -->
        Upload File
        <h:inputFile id="file"
                     label="file"
                     value="#{inputBean.part}"
                     required="true"
                     requiredMessage="File not selected !!">
        </h:inputFile>
        <h:message style="color: red" for="file" /><br />

        <h:commandButton id="submit"
                         action="#{inputBean.uploadFile}"
                         value="upload file" /><br />
    </h:form>

Testing on Tomcat 7.0.59, MyFaces 2.2.6

--
Mgr. Vojtěch Zavřel
System architect
AURA, s.r.o.
Úvoz 499/56
602 00 Brno
Czech Republic

Tel.: +420 544 508 181
Fax: +420 544 508 112
E-mail: vojtech.zav...@aura.cz
Internet: www.aura.cz
Certifikace ISO 9001, ISO 8000, ISO 27001 a ČOS 051622 (AQAP 2110)

Reply via email to