--

Allan Stuart Meidlein wrote:

> --
>
> Hello All,
>
> I have searched through the FAQ-o-Matic and have only found one entry
> related to images and servlets.  What I need to do is display some
> simple images within the servlet along with text; I understand that the
> HTML content type must be set to 'text/gif" or whatever format, but I'm
> confused at how I can have text and images on the same page when my
> content type is already set at "text/html."
>
> Thanks in advance.
>
> Allan
>

First, the content type for a GIF image is "image/gif", not "text/gif".

You are correct that you can not mix text and image output in the same
page.  What you need to do is include a normal image link, like this:

    <img src="xxxxx">

in the text output of your servlet (just as if you were authoring a
stand-alone HTML page).

Now, what is "xxxxx"?  Well, if the images you are talking about are
available at a particular URL on your web server, just use that URL and
the browser will download it in the usual way.

It is also possible to have a servlet dynamically create an image, by
using a URL that points back at your servlet.  An example is where you
might be constructing a graph image on the fly, using some graphics
library.  You will need to do something in the URL to tell your servlet to
return the image instead of a text page.

The browser will request this URL on a separate request from the one that
is causing your page to be created, so you never have to mix text and
binary data on the same request.

Craig McClanahan




--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
READ THE FAQ!!!!     <http://java.apache.org/faq/>
Archives and Other:  <http://java.apache.org/main/mail.html/>
Problems?:           [EMAIL PROTECTED]

Reply via email to