Hi

"out" is a predefined object in the jsp (it is a Writer to
response.getOutputStream()) so use another name.
ITOH, the code looks fine.

Regards.

"Girish T Deshpande" escribió en el mensaje
news:420976de.0307010841.21a22049@posting.google.c om...
> I am using Tomcat 4 and wish to download binary file(actualy an excel
> and pdf file) to the local disk.
> Since out.write ouputs the character array, I get error message when I
> pass byte array.
>
> The part of the code is below(I have set proper mime type)
>
> FileReader f = new

FileReader("C:/Tengli/jakarta-tomcat-4.1.24/webapps/ROOT/JavaExcel/ouput9.xl
s");
>
> BufferedInputStream inputStream = new BufferedInputStream(new
>

FileInputStream("C:/Tengli/jakarta-tomcat-4.1.24/webapps/ROOT/JavaExcel/oupu
t9.xls"));
>
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> byte[] buffer = new byte[1024];
> while (true) {
> int nBytes = inputStream.read(buffer);
> if (nBytes < 0) break;
> out.write(buffer, 0, nBytes);
> }
> //buffer = out.toByteArray();
>
>
> I also get the error that out is already defined in
> _jspService(......).
> If I use other variable name instead of out it compiles and runs fine
> but the file will be completely empty since it writes at unknown
> place.
>
>
> Could anyone give the entire code!
>
> Thank you