On Fri, 25 Jan 2002 [EMAIL PROTECTED] wrote:

> Date: Fri, 25 Jan 2002 17:57:05 +0100
> From: [EMAIL PROTECTED]
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: Re: BLOB FROM JSP PAGE
>
>
> Hi !
>
> your example has inspired me to try to return an ms-excel document as
> binary-result of a JSP.
> I adopted the code previously provided as follows:
>
> <%@page import="java.io.BufferedInputStream,
> java.io.ObjectOutputStream,java.io.OutputStream,java.io.File"%>
> <%
>   response.setContentType("application/vnd.ms-excel");
>   OutputStream f = response.getOutputStream();
>   File excel= new File("c:/temp/<some_excel>.xls");
>   BufferedInputStream bis = new BufferedInputStream (new
> FileInputStream(excel));
>   int a=0;
>   while ( (a=bis.read()) != -1 )
>   {
>     f.write(a);
>   }
>   bis.close();
> %>
>
> as a result the Exel file is printed out in text format, and the exception
> given below occurs:
>
> What may be the problem here ?
>

The problem is that you are trying to do binary output in a JSP page.
This is not supported.  Use a servlet for dynamically generated binary
output.

> Dirk

Craig


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to