Forums Register Login

File Download problem from java

+Pie Number of slices to send: Send
Hi,
Thanks in advance.
In our application we are using following code to save the file in XML format.

response.setContentType ("text/xml");
String filename=".xml";
response.setHeader ("Content-Disposition","attachment;filename="+filename);

With this it is opening a dialogue box prompting for name of the file,
but there is .xml[2],.xml[1].
Which is incorrect,actually I need there should be .xml direct, that is empty file name by default.
Please help me.

Regards,
Sree
+Pie Number of slices to send: Send
The reason it's putting the number behind the filename is probably bcause ".xml" exists already. I wouldn't use a filename that starts with ".", though. If accepted, the file will be invisible on Unix.
+Pie Number of slices to send: Send
Thanks a lot for the reply.
I am not giving the file name as '.' it is the extension suffix. like '.xml'.
And I am sure there is no such file existed for duplicate.
+Pie Number of slices to send: Send
I put this in a jsp and when i run it in tomcat 5.5 and invoke the jsp using IE 7. It works fine
<%
response.setContentType ("text/xml");
String filename="me.xml";
response.setHeader ("Content-Disposition","attachment;filename="+filename);
response.getWriter().write("<kfdj>jjjdfjd<dkfjdk>");
response.getWriter().flush();
response.getWriter().close();

%>
Hope this helps
[ August 08, 2007: Message edited by: Sundaram Karthick ]
+Pie Number of slices to send: Send
Of course, Sundaram Karthick is not advocating doing anything like this in a JSP, he's just providing that as a sample test. (right?)
+Pie Number of slices to send: Send
Yes, Bear Bibeault. My intention of adding this piece of code was to just say it was working in my environment, as you said doing this type of activity in jsp is not that bright idea
What's gotten into you? Could it be 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 1020 times.
Similar Threads
download link in jsp ?
parsing prob
Question on IDE?
why .java filename constraint ?
Delete file when the file downloaded.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 20:39:20.