> -----Original Message-----
> From: john-paul delaney [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 18, 2002 1:34 PM
> To: Tomcat Users List
> Subject: RE: NewB/Default Servlet:Can't find .gif
> 
> 
> 
> 
> 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 default servlet handles requests that don't map to some other
serlvet.  This usually includes all static content and requests
that match directories.  It is the resposibility of the default
servlet to serve these requests in a appropriate manner. The
default servlet supplied by Tomcat implements serving static
resources and directory listings.  If your default servlet doesn't
support this, you will lose this feature if you replace Tomcat's
default servlet.

Larry

> 
> The path to the servlet is standard:
> $CATALINA_HOME/webapps/ap.org/WEB-INF/classes/intro.class.
> 
> The image is in the context root $CATALINA_HOME/webapps/ap.org/
> 
> 
> > > 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 off-track?
> 
> thanks for your comments/j-p.
> 
> 
> -----------------------
>  JUSTATEST Art Online
>   www.justatest.com
> 
> 
> 
> 
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to