Download file with JSF

前端 未结 1 547
孤独总比滥情好
孤独总比滥情好 2020-12-22 08:48

everyone!

I have a trouble. I tried to save excel file in jsf web application. I generated file by my utils and trying to get \"save\" window, but I failed.

相关标签:
1条回答
  • 2020-12-22 09:09

    Maybe the problem in the request - it has header Faces-Request partial/ajax. But I am not sure.

    This suggests that the request is an ajax request. You can't download files by ajax. Ajax requests are processed by JavaScript which has for obvious security reasons no facilities to programmatically pop a Save As dialogue nor to access/manipulate client's disk file system.

    Your code snippet does however not show that you're using ajax. Perhaps you oversimplified it too much or you're using ICEfaces which silently auto-enables ajax on all standard JSF command components.

    In any case, you need to make sure that it's not sending an ajax request.

    See also:

    • How to provide a file download from a JSF backing bean?
    • ICEfaces libary in classpath prevents Save As dialog from popping up on file download
    0 讨论(0)
提交回复
热议问题