Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SaveAs dialog box in JSP

Status
Not open for further replies.

jollyplay

Programmer
Dec 16, 2003
90
0
0
Hi
In my JSP I have to download the data from the database as a csv file. I am using the query

"SELECT * INTO OUTFILE 'c:/data.csv' FIELDS TERMINATED BY ',' FROM emp"

The path specified in the query is specified by the user.I tried
<%response.setContentType("text/csv");
response.setHeader(Content-Disposition", "attachment; filename=" + "asd.csv" )%>
By including the above line the jsp page is downloaded. I am confused. How can I pass the path to the query. Please provide me link or code for this.

Thanks in advance.

 
Hi,

If I understood your question correctly, you wan to save the .csv file which was created by SQL Query on to the clients desktop to the location which the user has specified?

I dont think it is possible this way. The best would be create a jsp file with the result and then set the content type to csv and disposition as attachment, when it prompts SaveAs the user can save the file to his prefferd location.

Cheers
Venu
 
Thanks for your replay. I tried this by setting the setContentType as csv. If we specify like that the jsp page is saved as a csv file not the data file we stored as a csv file.

Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top