On Wed, 23 Feb 2000, Betty Jo Booth wrote:

> Hmmm....
>
> Sorry to barge in, but now I'm confused.  If it's done in two
> responses, won't that result in two pages (one displaying an image
> and the other html), rather than an image and html together on one
> page?

Well, think about it a bit.  Anytime there's an embedded image with an
IMG tage, it's handled with a separate request/response.  It'll be the
same thing whether the whole page is served statically by a web server
or dynamically by a servlet.

The real question here is whether the image is going to be served by
the web server or the servlet.  If by the web server, then just put an
appropriate URL in the IMG tag.  If doing so, be careful of using
relative URLs, because if it's in the same directory relative to the
servlet, the request will go to the servlet, and in this case you
don't want that.  If by the servlet, then you do want the request
going to the servlet, and you have to have something on the URL (like
parameters) indicating that it is an image that is to be returned, and
what image it is.  And you have to have set up your servlet to handle
returning images.

I suspect that most people will want to use the former approach,
unless perhaps their images really are dynamic.


> ----- Original Message -----
> From: Frankie Wu <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, February 22, 2000 5:31 PM
> Subject: Re: display image and text/html together
>
>
> > You should do it through two seperately responsing.
> > one respones a text/html MIME type content to client, and the other
> responses a image/gif MIME type.
> >
> > Frankie
> >
> > ----- Original Message -----
> > From: Yang XIAO <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, February 22, 2000 11:32 PM
> > Subject: display image and text/html together
> >
> >
> > > Hi, list
> > >
> > > Can anyone please tell me how to display a local image file and
> text/html
> > > together in a page on the web?
> > >
> > > since the content type and getoutputstream have to be set to display an
> > > image:
> > > response.setContentType("image/gif");
> > > ServletOutputStream out = response.getOutputStream();
> > >
> > > But for a text html,
> > > response.setContentType("text/html");
> > > PrintWriter out = response.getWriter();
> >
>

Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to