jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes Servlet Prompting to Save File? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Prompting to Save File?" Watch "Servlet Prompting to Save File?" New topic

Servlet Prompting to Save File?

Brian Swingle

Joined: Feb 12, 2003
Posts: 14
Twice when i've tried to run my servlet which is hosted i get prompted to save a file. Once i make the selection then nothing happens. My response type is set as text/html is that maybe the cause?
If anyone has had this happen to them and could halp it would be greatly appreciated.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
I am unclear here. What is your servlet trying to do? Is it what is asking for the file to be saved or is this outside the functionality of your servlet?

"JavaRanch, where the deer and the Certified play" - David O'Meara
Chris Smith
Ranch Hand

Joined: May 03, 2002
Posts: 42
That is definitely a bit odd. A couple possibilities:
1. Are you setting a Content-disposition header? If so, what is it?
2. IE will ignore the reported content type if the URL (minus the query string) ends with an extension that it thinks it knows. What does the request URI look like?
Hernando Guerra

Joined: Mar 11, 2003
Posts: 3
ya can force it using:
response.setHeader ("Content-Disposition", "attachment;filename=\"result.xls\"");
if the file was written on the response output stream, the secret is to use the "attachment;filename..." part
I agree. Here's the link: http://aspose.com/file-tools
subject: Servlet Prompting to Save File?
It's not a secret anymore!