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

downloading text file in jsp

 
subodh varshney
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Report post to moderator
PrintWriter out1 = response.getWriter();
response.setContentType("application/octet-stream");
response.addDateHeader("Expires", 1);
response.setHeader("Content-Disposition","attachment;filename="+pagename);
out1.write(contents.substring(0,contents.length()).trim());


I m using above code it is working, but when i download file it includes some extra lines(whitespaces) in the haeder of the file
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Report post to moderator
Doubleposted: http://www.coderanch.com/t/439858/JSP/java/downloading-txt-file-through-jsp
Please do not use browser's back button to edit a message. You're going to repost the complete message again. Use the message's edit button.
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Subodh, please do not post the same question multiple times.It only wastes the useful time of other ranchers and reduces the number of responses you get. Read this for more information.

I am closing this one for you.
 
    Bookmark Topic Watch Topic
  • New Topic