Returning csv from jsp page

C

Chris

My webapp needs to return a dynamically-generated .csv file to the user. I
can create a .jsp page that returns the csv, and I add <%@ page
contentType="text/csv" %> to the top of the page to specify the mimetype.
When I click on a link that points to the page, the browser (IE) correctly
asks whether to open or save the file.

Here's the problem: the filename it suggests has a .jsp extension, not a
..csv extension. How can I change this?
 
S

SMC

My webapp needs to return a dynamically-generated .csv file to the user.
I can create a .jsp page that returns the csv, and I add <%@ page
contentType="text/csv" %> to the top of the page to specify the
mimetype. When I click on a link that points to the page, the browser
(IE) correctly asks whether to open or save the file.

Here's the problem: the filename it suggests has a .jsp extension, not a
.csv extension. How can I change this?

response.setHeader("Content-disposition","attachment;filename=\"blah.csv\"");


--
Sean

I've noticed that when I use rational analyses of situations that ignore
the emotional aspects, people become hostile. This is because they are
defective. --newsgroup post
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top