| Author |
downloaded file not written properly(File content written from 10th line why)
|
rajareddya reddy
Ranch Hand
Joined: Jul 23, 2011
Posts: 42
|
|
Hi,
My requirement is to get the file content from temporary file and then I am writing to one more file which I created and I need to download the same file. When I am executing the following code , I am able to download the file but I am seeing 10 lines with empty spaces. That means code is writing the conent in the new file from 10th line.Please corerct the code,why its writing content from 10th line in the new file.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56554
|
|
|
Step 1: Move the code out of a JSP and into a Java servlet. Then we can take it from there.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
William P O'Sullivan
Ranch Hand
Joined: Mar 28, 2012
Posts: 860
|
|
1. Bear is right.
2. JSP generates blank lines everywhere and anywhere it can! that is the nature of the beast.
WP
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19232
|
|
|
In this case, lines 1-7 all add one line break before any binary data is written to the response.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56554
|
|
|
Please read this article to find out why using a JSP for this purpose is a big FAIL.
|
 |
rajareddya reddy
Ranch Hand
Joined: Jul 23, 2011
Posts: 42
|
|
Thanks for all for your replies.
I tried the same code with servlet . now its working fine.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56554
|
|
|
Using the right tool for the job frequently yields better results.
|
 |
 |
|
|
subject: downloaded file not written properly(File content written from 10th line why)
|
|
|