Why do you need to use a JSP - The JSP is designed to product HTML output,
and as such will always grab the writer and set the content type to
text/html.

What is wrong with just using the servlet, perhaps with an extention mapping
. . .

-----Original Message-----
From: Tali Ambar [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 02, 2001 2:12 AM
To: '[EMAIL PROTECTED]'
Subject: FW: [ERROR] OutputStream is already being used for this request




> Hi
>
> 1. I'm trying to pass a stream to an html in order to see GIF files in a
> stream form on the browser.
>
> 2. I wrote (in a servlet) the following lines
>
> IStream  stream = ...; // stream of a  file in a GIF format
>
> response.setContentType ("image/GIF");
> ServletOutputStream outStream = response.getOutputStream();
>
> int p1 = 10000;
> int[] p2 = new int[1];
> byte bytes[] = new byte[1];
> stream.RemoteRead(bytes,p1,p2);
> outStream.write(bytes);
>
> 3. This servlet is called by a jsp which is called from an Html file (by
> the tag:  <img src="myJsp.jsp">)
>
> 4. When running only the servlet I can see the GIF file.
>
> 5. When I run the jsp I get the following error:
> "Error 500:
> OutputStream is already being used for this request
> at org.apache.tomcat.core.ResponseImpl.getWriter(ResponseImpl.java:210)"
>
> 6. running the html file fails
>
> 7. I can not use PrintWriter servlet because I need to pass binary data
> and not test.
>
> Thanks
> Tali
>
> Email: [EMAIL PROTECTED]
>

Reply via email to