Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create a jpg via servlet and display it with jsp

Status
Not open for further replies.
Apr 13, 2004
16
DE

hallo,

one question: i have create a jpeg objekt with a servlet. now i will display this object in a jsp. i thougt about an <img> tag, woh accepts an object instat a file. can anyone help me? thanks for help.


ps: sorry for my englisch.

mfg
 
You can create images such as jpegs by using the Java2D class BufferedImage, and then encode it using javax.imageio or JAI :



After creating the image, then set the content type of the servlet :

response.setContentType("image/jpeg");

and write out your jpeg byte[] array data :

response.getOutputStream().write(bytes);

--------------------------------------------------
Free Database Connection Pooling Software
 
thanks for help,

your suggestion looks at the moment a little bit complicated, so have use the batik framwork an write the jpeg with the OutputStream. i read imageio api latter, it looks very intresstiing. thanks for help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top