You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Georges Boutros <GB...@interstarinc.com> on 2001/04/17 20:42:48 UTC

ServletOutputStream

hi,

i want to use the ServletOutputStream to send the data of a JPG image to the
browser.
ServletOutputStream ServletOut = response.getOutputStream();

it's working good but i can't write any text before or after the image.
if i set  response.setContentType("text/html");
	i see the text that i wrote and the data of the image as text
(which is normal)
and if i set  response.setContentType("image/jpeg");
	i don't see the text neither the Image

i use ServletOut.Print("hello"); to write my text

if i include a file with:
request.getRequestDispatcher("/jsp/web/test.jsp").include(request,
response);

i got an error that OutputStream is already being used for this request 

can anyone help me

thanks

Georges

Re: ServletOutputStream

Posted by Sam Newman <sa...@stamplets.com>.
Couldn't you try creating the jpg on the server side, then supply an IMG
link to it when you provide the page?

sam
----- Original Message -----
From: "Georges Boutros" <GB...@interstarinc.com>
To: "Tomcat (E-mail)" <to...@jakarta.apache.org>
Sent: Tuesday, April 17, 2001 7:42 PM
Subject: ServletOutputStream


> hi,
>
> i want to use the ServletOutputStream to send the data of a JPG image to
the
> browser.
> ServletOutputStream ServletOut = response.getOutputStream();
>
> it's working good but i can't write any text before or after the image.
> if i set  response.setContentType("text/html");
> i see the text that i wrote and the data of the image as text
> (which is normal)
> and if i set  response.setContentType("image/jpeg");
> i don't see the text neither the Image
>
> i use ServletOut.Print("hello"); to write my text
>
> if i include a file with:
> request.getRequestDispatcher("/jsp/web/test.jsp").include(request,
> response);
>
> i got an error that OutputStream is already being used for this request
>
> can anyone help me
>
> thanks
>
> Georges
>