<servlet-mapping>
        <servlet-name>MyServlet</servlet-name>
        <url-pattern>index.html</url-pattern>
</servlet-mapping>

I think you have to have an empty "index.html" file to convince the
<welcome-list> that its valid.

This will take all index.html files, so if you have other index.html files
in other directories, add a dummy.html to the <welcome-file> list and map it
to your servlet.

I recall doing this in 3.2, so I'm not sure if it still works in 4.0 -
although I don't see why it wouldn't.

Charlie

> -----Original Message-----

> From: Scott Eade [mailto:[EMAIL PROTECTED]]
> Sent: Friday, December 21, 2001 7:54 AM
> To: [EMAIL PROTECTED]
> Subject: servlet-mapping problem - tomcat 4.0.1
> 
> 
> How do I default a user to my servlet without blocking access
> to other directories?  Using a default mapping of "/" results in
> failure to gain access to resources under my servlet directory.
> 
> I think I have a fairly standard set-up of tomcat 4.0.1 on win2k.
> 
> Within C:\jakarta-tomcat-4.0.1\webapps I have a directory
> structure like this:
> 
>     myapp
>             styles
>                     global.css
>             WEB_INF
>                     web.xml
>                     lib
>                             [jar files]
> 
> web.xml defines a servlet whose output includes a reference to 
> http://mysite.com/myapp/styles/global.css
> 
> If I set my servlet mapping up like this:
>     <servlet-mapping>
>         <servlet-name>myapp</servlet-name>
>         <url-pattern>/</url-pattern>
>     </servlet-mapping>
> then the stylesheet cannot be loaded when the user surfs to
> http://mysite.com/myapp/
> 
> Alternatively if I set up my mapping like this:
>     <servlet-mapping>
>         <servlet-name>myapp</servlet-name>
>         <url-pattern>/foo/*</url-pattern>
>     </servlet-mapping>
> then the stylesheet can be located, but the user must surf to
> http://mysite.com/myapp/foo/
> 
> How can I configure tomcat or structure my directories so that 
> a user can surf to http://mysite.com/myapp/ and also successfully
> access the stylesheet?
> 
> Note that the above is a contrived example.  The real servlet
> includes many other resources in the myapp directory to which
> the servlet refers.
> 
> Any advice would be most welcome.
> 
> Thanks,
> 
> Scott
> 
> 
> 
> --
> 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