tomcat-users mailing list archives

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

Thanks Justin...

excerpt from web.xml>>>

 <servlet>
   <servlet-name>
          intro
   </servlet-name>
   <servlet-class>
          intro
   </servlet-class>
 </servlet>
						
 <servlet-mapping>
   <servlet-name>intro</servlet-name>
   <url-pattern>/intro</url-pattern>
 </servlet-mapping>
		  

intro.class is in $CATALINA_HOME/webapps/ap.org/WEB-INF/classes
test.gif in in $CATALINA_HOME/webapps/ap.org/


intro.java>>>

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class intro extends HttpServlet {

   public void doGet( HttpServletRequest req, HttpServletResponse res )
       throws ServletException, IOException {

       res.setContentType("text/html");
       PrintWriter out = res.getWriter();

       out.println( "<html><head><title>justatest</title></head>"
);

       out.println("<img src=\"/test.gif\" width=\"146\" height=\"125\" alt=\"TEST\">");

       out.println( "<body><h1>Justatest...!</h1></body></html>"
);
   }
}
				     

Here I realise I may have misled you: 
This page renders ok if I explicitly point to url www.domain.org/intro 
                                                                 ^^^^^
It fails if I change the url-pattern within the servlet-mapping to "/" (and access it with
the url www.domain.org/) - the test.gif is no longer found by the server.


Any suggestions? Rgds/j-p.



On Mon, 18 Feb 2002, Justin Rowles wrote:

> > I'm confused as to why once I change the servlet-mapping from 
> > "/" to "/intro" that the .gif is read.
> 
> So am I ;-)
> 
> Can you print out the output from either case and send it.
> 
> J.
> 

-----------------------
 JUSTATEST Art Online
  www.justatest.com




--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message