> ensure you put it in correct package. My example servlet is not part of a package. Here is the opening part of the source code file:
import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class Ch1Servlet extends HttpServlet{ > The author probably mean the classname+package. Since my servlet is not part of a package, I placed it in the default "classes" directory: C:\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\WEB-INF\classes Given these two pieces of information, how should I fill in the web.xml file: <servlet> <servlet-name>ch1</servlet-name> <servlet-class>^</servlet-class> |________________What goes here? </servlet> <servlet-mapping> <servlet-name>ch1</servlet-name> <url-pattern>/ch1</url-pattern> </servlet-mapping> Thanks. -- Charles Knell [EMAIL PROTECTED] - email -----Original Message----- From: David Delbecq <[EMAIL PROTECTED]> Sent: Mon, 20 Mar 2006 14:44:25 +0100 To: Tomcat Users List <users@tomcat.apache.org> Subject: Re: What, exactly, is meant by "full path" when construction web.xml entries [EMAIL PROTECTED] a écrit : >I've poked at Tomcat for several years now. I find myself looking for a job >and have too much time on my hands, so I've decided to take servlets seriously >and grasp the concepts. > >Yesterday I spent a fair amount of time Googling for how to set up a <servlet> ><servlet-mapping> pair of elements in the web.xml file on my Windows XP >installation of Tomcat 5.5.15. > >Fustrated at my inability to get these correct, I simply placed a servlet >class I copied from a book and compiled on my machine into this directory: > >C:\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\WEB-INF\classes > > eg if the class is com.mycompany.MyServlet, then you must put MyServlet.class in WEB-INF/classes/com/mycompany/ >My thought was that if I couldn't get the web.xml stuff right from looking at >various examples and explanations I was reading, if I could get one working by >using the full path to the servlet class, I could "reverse engineer" the >meaning of the web.xml instructions I was reading. > >The term "full path" comes from an explanation of what text ought to go into >the <servlet-class> element child of the <servlet> element in web.xml. In >serveral > The author probably mean the classname+package. eg: com.mycompany.MyServlet >articles I found, this phrase was used, as in "the full path to the servlet >class". To me, a "full path" means all the way back to the root directory of >the device in question, but I get the feeling that this isn't what these >authors meant. I rather suspect that they mean a relative path from some point >that is the root of the Tomcat application. > >So far, in the address box of my browser, I have tried: > >http://localhost:8080/ROOT/WEB-INF/classes/Ch1Servlet > >http://localhost:8080/WEB-INF/classes/Ch1Servlet > >http://localhost:8080/classes/Ch1Servlet > >http://localhost:8080/Ch1Servlet > > Content of WEB-INF/ is not accessible to browser, no need to try downloading it. To access a servlet, that servlet must be mapped in WEB-INF/web.xml Tomcat also comes with a special servlet capable of dynamicaly loading other servlet classes. This is disabled by default. >In each case I get an HTTP Status 404 error telling me that "The requested >resource (here you can fill in each substring above starting at the first '/') >is not available." > >Reading and re-reading has not cleared up this mystery for me. Can some tell >me in a no-jargon way, exactly how to get this servlet to become "available"? > > with a servlet mapping in web.xml, that's how you should make it available. >Thanks. > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]