Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
    Bookmark Topic Watch Topic
  • New Topic

Re: downloading from a servlet

 
Adewale Adebusoye
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello:
i included the servlet response headers:

response.setHeader("Content-Type", "text/plain");
response.setHeader("Content-Disposition", "attachment; filename=file.txt"));

the only thing that its not downloading my attached file, rather, its set the filename to null, and its downloading the dynamic html generated by my servlet into a file.

So am i supposed to actually code for the download itself?

Please reply
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Adewale,
Please keep your question in one thread.
It gets confusing if it's spread out in multiple threads.

The original is here:
http://www.coderanch.com/t/362023/Servlets/java/downloading-servlet
 
    Bookmark Topic Watch Topic
  • New Topic