tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john-paul delaney>
Subject RE: NewB/Default Servlet:Can't find .gif
Date Mon, 18 Feb 2002 18:33:42 GMT

On Mon, 18 Feb 2002, Justin Rowles wrote:

> > PROBLEM:  A test.gif image is not rendered by the servlet - 
> > as it appears the path is not found.
> Are you trying to return html including an image link (such as <img src="test.gif">)
or trying to stream an image via the servlet?  
> If the latter, then jsp is the wrong tool - it is text only.  If not, read on:

Yes, the latter.  Only I was thinking of generating the page with a servlet, and not creating
a .jsp file.  Is this terribly mistaken?

> > OBSERVED:  If I map the servlet instead to "/intro" then the 
> > test.gif is rendered ok.

I'm confused as to why once I change the servlet-mapping from "/" to "/intro" that the .gif
is read.

The path to the servlet is standard:

The image is in the context root $CATALINA_HOME/webapps/

> > NOTE:  I've read some postings advising locating files should 
> > be done as in InputStream [getResourceAsStream()].  Is it 
> > applicable in this case when all I want is a simple 
> > 	out.println( "<img src=\"/test.gif ... etc )?
> Oh, then you are trying to do it right!  Good.

But the simple PrintWriter statement to write the html <img> element works fine when
the servlet-mapping is not "/"?  Can't I just use the same in some other guise - or am I way

thanks for your comments/j-p.


To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message