t:inputFileUpload not uploading the file

前端 未结 1 1683
小蘑菇
小蘑菇 2021-01-16 07:11

I am using myfaces ExtensionFilter to upload a file, but the file is not getting set to my bean for further processing.

Here is the code :



        
相关标签:
1条回答
  • 2021-01-16 07:35

    It is not possible to upload files by ajax with current JSF and Tomahawk version. Ajax requests as created by JSF do not support nor use multipart/form-data. Tomahawk is not an ajax based component library. Use a normal command button instead.

    <h:commandButton value="#{tpMsgs.upload}"
        styleClass="button" action="#{paramUpload.uploadParamFile}"
        onclick="javascript:updateParentScreen();">
    </h:commandButton>
    

    Support for uploading files with ajax is scheduled for upcoming JSF 2.2 with new <h:inputFile> component.

    Alternatively, you can use RichFaces' own <rich:fileUpload>. Depending on the RichFaces version used, it uses either Flash or an iframe hack under the covers to achieve asynchronous file uploading.

    0 讨论(0)
提交回复
热议问题