This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
    Bookmark Topic Watch Topic
  • New Topic

downloading text file in jsp

 
subodh varshney
Greenhorn
Posts: 11
  • 0
  • 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
  • 0
  • 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: 2851
10
Fedora Firefox Browser Java
  • 0
  • 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