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.
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 !
Its not what you do, its how well you do it.
posted 10 years ago
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