Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Prompting to Save File?

 
Brian Swingle
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
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"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Chris Smith
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brian,
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
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya can force it using:
response.reset();
response.setContentType("application/vnd.ms-excel");
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic