Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

convert data into JSP into .csv format

843838Sep 26 2005 — edited Mar 3 2009
Hi,

I have a jsp page, where data comes in from a database. I want to convert this data into .csv format.

I have written the following lines of code in the onClick event of the button:

response.setContentType("text/csv");
response.setHeader("Content-Disposition","filename=\"test.csv\"");

This code is inside scriptlet tags inside the javascript function.

I find that in addition to the data, all the javascript function etc. appear in the .csv file. Also, i want the file open dialog box to open, when i click on a button. But, now this is happening on page load.

How to rectify this?

Regards,
jayashree.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 31 2009
Added on Sep 26 2005
15 comments
2,384 views