You need to generate the image on a separate request.

Inside your template, there should be an <img> tag with a src parameter
referencing your servlet
For example: <IMG SRC="http://www.server.com/webapp/servlet?mode=image";>

The servlet should then return an image as a binary stream if it sees the
"mode=image" parameter.

There is no way to output both HTML and an image to the browser on the same
request, as HTML doesn't provide a mechanism to "embed" images in the
document, only to reference them.

-----Original Message-----
From: Jeff Owens [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 16, 2003 1:26 PM
To: Velocity Users List
Subject: Multipart template



Does Velocity provide some way of utilizing a multipart content-type
template?

In other words: I have a servlet generating data for a Velocity template.
Along with text such as name and address, I want a picture to be embedded
within the web page.  HOWEVER, the picture is coming as binary data - NOT a
<img> link or anything like that.

Limitations:
1.  The picture is not stored as a file, it will come from the servlet as
binary data.
2.  The picture must be embedded within a velocity template somehow.
3.  The template I need the picture to go in is already a very nice Velocity
template - I'm not interested in generating the page html myself or
switching to some other templating system.  (I would generate just the
portion of the html for the picture - if I can embed it in the template
somehow)

Thanks for your help,
Jeff Owens



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to