This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JSP and the fly likes downloading text file in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

downloading text file in jsp

subodh varshney
Greenhorn

Joined: Aug 01, 2005
Posts: 11
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

Joined: Oct 08, 2006
Posts: 2458
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

Joined: Jun 06, 2007
Posts: 2716
    
    6

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.


SCJP, SCWCD.
|Asking Good Questions|
 
GeeCON Prague 2014
 
subject: downloading text file in jsp