Win a copy of Murach's Python Programming this week in the Jython/Python forum!
    Bookmark Topic Watch Topic
  • New Topic

file download dialog box  RSS feed

 
Priyadharshini Nagarajan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Report post to moderator
Below is the code for file download dialog box.

response.setContentType("text/plain");
response.setHeader("Content-Disposition","attachment; filename=" + file.getName());
ServletOutputStream sos = response.getOutputStream();
ByteArrayOutputStream out1 = new ByteArrayOutputStream();
out1.write(file.getContent());
sos.print(out1.toString());
sos.close();

i have a class which gets the content and file name.

for me the save button in the file download dialog box is working.But the open button is not working ie when i open the file it is saying

"Create a new File because it does not exist"

Thanks in advance
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Since you've already asked this question in the Servlets forum, this one will be closed.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!