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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mixed JSP content

Status
Not open for further replies.

Vadim

Programmer
Feb 5, 2002
75
US
I created simple JSP that convert graphic to jpeg like that

//*****Make a Simple Image object*****
response.setContentType("image/jpeg");
BufferedImage image=new BufferedImage(500,100, BufferedImage.TYPE_INT_RGB);
Graphics g=image.getGraphics();

g.setColor(Color.blue);
g.fillRect(425,25,50,50);

g.setColor(Color.red);
g.setFont(new Font("Serif", Font.ITALIC, 48));
g.drawString("Hello World!", 10, 50);

JPEGImageEncoder encoder=JPEGCodec.createJPEGEncoder(response.getOutputStream());
encoder.encode(image);
//*****End a Simple Image object*****

I'd like to know how to mixed that picture with regular html tags before and after image, or may be it's possible
to combine 2 JSP one that generate image and another that produce a text.
 
Yes you combine them into a single application. The first JSP produces the HTML and sends it to the browser containing the <img> tag the points to the second JSP. The browser parses the HTML and then requests the image from the second JSP which returns the image data. Make sense?

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top