struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Mulligan <david.mulli...@LECAN.ie>
Subject RE: Displaying a dynamically created Image.
Date Fri, 05 Jul 2002 13:24:38 GMT
Use the HttpServletResponse.getOutputStream() to send a stream of the image
back to the browser.
Be sure to set the correct content-type of the image first using
HttpServletResponse.setContentType('image/gif);
So it will be something like 


response.setContentType('image/gif);
OutputStream os = HttpServletResponse.getOutputStream();

BufferedInputStream is = //input stream of image

byte[] bytes = new byte[is.available()];
is.read(bytes);

OutputStream os = response.getOutputStream();
os.write(bytes);

Don't forget to close the both the input and output streams!


-----Original Message-----
From: mhanel@lwplus.de [mailto:mhanel@lwplus.de]
Sent: Friday, July 05, 2002 2:05 PM
To: struts-user@jakarta.apache.org
Subject: Displaying a dynamically created Image.



How do I display a dynamically created Image with struts 
without saving it to my local harddisc and link the image on it?
thanks matthias

----------------------------------------------------------------------------
----------------
Hanel Matthias
Fachinformatiker (Anwendungsentwicklung) in Ausbildung
Logistik World GmbH	Fon:	+49-841-9014-300
Marie-Curie-Strasse 6	Fax:	+49-841-9014-302 
D- 85055 Ingolstadt    	mailto:mhanel@lwplus.de
----------------------------------------------------------------------------
----------------


--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message