You are using a relative location in your img tag so the browser is looking
for "/servlet/foo.gif".
Are you using JSDK 2.1 (and Java 2)? If you are you can just place your
image in the document root for the servlet engine and use
out.println("<img src=\"/foo.gif\"
Aaron
> -----Original Message-----
> From: Ray Tayek [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 08, 1999 9:42 PM
> To: [EMAIL PROTECTED]
> Subject: how to reference a .gif in html in from?
>
>
> hi, have tried lots of obvious things, but can't seem to get
> the gif to
> appear in the browser. the gif is in the user.dir. am using vc 3.0a on
> win98/oem.
>
> thanks
>
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> public class HelloWorld extends HttpServlet
> {
> public void doGet(HttpServletRequest req,
> HttpServletResponse resp)
> throws ServletException, IOException
> {
>
> System.out.println("user.dir="+System.getProperty("user.dir"));
> resp.setContentType("text/html");
> PrintWriter out = new
> PrintWriter(resp.getOutputStream());
> out.println("<HTML>");
> out.println("<HEAD><TITLE>HelloWorld</TITLE></HEAD>");
> out.println("<BODY>");
> out.println("<big>Hello World</big>");
> out.println("<img src=\"foo.gif\"
> width=\"153\" height=\"32\"
> align=\"right\">");
> out.println("</BODY>");
> out.println("</HTML>");
> out.close();
> }
> }
>
> loading sun.servlet.http.HttpServer.class for debugging...
> sun.servlet.http.HttpServer.class successfully loaded
> Loading browser for running servlet....
> Browser for running servlet successfully loaded.
> servletrunner starting with settings:
> port = 8080
> backlog = 50
> max handlers = 100
> timeout = 5000
> servlet dir = .
> document dir = .
> servlet propfile = .\servlet.properties
> HelloWorld: init
> user.dir=D:\usr\martin\servlet\helloworld
> Servlet not found: foo.gif
>
> Ray (will hack java for food) http://home.pacbell.net/rtayek/
> hate Spam? http://www.blighty.com/products/spade/
___________________________________________________________________________
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