Its a little clunky, but you could use your second 'foo' mapping, and then
have an index.htm that does a meta-refresh to redirect them to your servlet:

<meta http-equiv="Refresh" content="0; url=foo/">


Not nice and invisible I know, but it'll work..

ian



----- Original Message -----
From: "Scott Eade" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 21, 2001 12:53 PM
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