Forums Register Login

Exporting CSV file from Server with Save-As Dialog box.

+Pie Number of slices to send: Send
Hi all,
I do have a CSV file on the server running which can be referred through http://<hostname>:<ip>/project/<projName>/test.csv. When i click a link on the JSP page it has to pop out with the save as dialog box to export that CSV File on the server. Can anyone suggest me how to do this? Your reply could help me to proceed further. The CSV file was created through BufferedOutputStream using Java on the server end.

Thanks & Regards,
Jazznpselvan.
+Pie Number of slices to send: Send
Look into the response headers - Content-disposition, Content-type. You should find your answer there.
+Pie Number of slices to send: Send
entire code for Save As Dialog box need to be written in JSP file
also, the contentType for JSP will be "application/rtf" ... this contentType will make the JSP open as Save As Dialogue box

As mentioned in the above post refer response.addHeader & response.setHeader

use simple out.print statements to write data into csv file

Good Luck !
+Pie Number of slices to send: Send
 

Kun All wrote:entire code for Save As Dialog box need to be written in JSP file
also, the contentType for JSP will be "application/rtf" ... this contentType will make the JSP open as Save As Dialogue box...


That's NOT true at all! The implementation doesn't necessarily have to be written in a JSP. A servlet can do the job perfectly, and from a separation-of-concerns perspective, the JSP should NOT include such server side implementations!
As for the content type for a CSV, it is text/csv and text/comma-separated-values
Amateurs built google. Professionals built the titanic. We can't find the guy that built this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2802 times.
Similar Threads
white space problem
file downloading from the server
Cannot get Netscape 6.1 to open save as dialog box
Save a webpage as PDF or Excel file
CSV file to open in Excel
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 07:02:45.