将文件另存为-具有动态数据的对话框 [英] Save file as - dialog box with dynamic data
本文介绍了将文件另存为-具有动态数据的对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道这个问题很普遍,但是它的细节困扰着我.
I know that this question is quite common, but its specifics are stumping me.
我有一个导出"按钮,我要提取生成的数据,创建一个CSV文件,然后弹出另存为"对话框,以将该文件保存在本地计算机上.
I have an "export" button which I want to take a load of data generated, create a CSV file, then pop up a Save File As dialog box, to save that file on their local machine.
此文件的名称也是动态的.
The name of this file is dynamic, also.
我知道如何制作CSV文件,但是如何在客户端弹出一个框让用户下载它呢?
I know how to make the CSV file, but how do I then pop up a box on the client side to let the user download it?
我在Struts中使用JSP
I am using JSP with Struts
推荐答案
您需要做的就是发送一个响应,其中包含生成的带有标题的csv:
All you need to do is to send a response containing your generated csv with a header:
Content-Disposition: attachment; filename=your_file.csv
这篇关于将文件另存为-具有动态数据的对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文