I'm having trouble using a servlet as a welcome file in Tomcat 5. I haven't found any definitive documentation on how to do it (The Servlet 2.4 spec doesn't even seem to be clear), but I've tried the following (taken from: http://www.onjava.com/pub/a/onjava/2004/02/11/jspcookbook.html):

|    <servlet>
       <servlet-name>MyServlet</servlet-name.
       <servlet-class>com.jspservletcookbook.MyServlet</servlet-class>
   </servlet>
   <!-- optionally map the 'MyServlet' servlet to a URL pattern -->
   <servlet-mapping>
       <servlet-name>MyServlet</servlet-name>
       <url-pattern>/myservlet</url-pattern>
   </servlet-mapping>
   <!-- rest of web.xml ... -->|

|    <welcome-file-list>
       <welcome-file>MyServlet</welcome-file>
       <welcome-file>default.jsp</welcome-file>
   </welcome-file-list>|


The names were changed to match my particular needs, but the functionality should have been the same. I'm using the 2.4 xsd. The servlet I'm trying to map is a Struts ActionServlet, so the URL pattern is actually "*.do", not "/myservlet", but my understanding is that it shouldn't matter. With that all done, requests to http://mymachine/myWebapp/ should call MyServlet, but they don't. Either default.jsp is returned or a directory listing if default.jsp is missing.


Does this work in TC5, and if so, how do I make it work?

K.C.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to