tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: 2 WEB.XML questions
Date Thu, 20 Jul 2000 17:44:04 GMT
Dave Fox wrote:

> Running Tomcat v3.2b2, NT4sp6
> I have an observation and a two questions regarding web.xml/web.dtd.  I am
> using the following web.xml and everything is working correctly.  Notice
> however that I didn't follow the dtd when I put a 2nd <url-pattern> mapping
> in my servlet mapping. I would like some feedback on why this works and
> whether this might be something worthly of be officially added to the dtd.

Tomcat should not accept this, and it is broken if it does.

Adding something to the DTD means changing the servlet spec.  If you
want to
suggest this, you should submit the idea to the
"" address on the cover page of the

IMHO this is not necessary, because you can easily define multiple
<servlet-mapping> entries that point at the same servlet, using
different url
patterns on each one.

> My second question: why do I have to put '/servlet/' in front of the servlet
> name in my secondary mappings.  (I have to do this even if I follow the dtd
> and put every <url-mapping> in it's own <servlet-mapping>.)  If I remove
> '/serlvet' Tomcat can't find the servlet.  ????

If this is true, you're doing something wrong.

For example, let's say your app is in a context called "/myapp".  You
might have
in your web.xml file:



then the following URL will access this servlet:


Note that the servlet mapping's URL pattern is relative to the context
path.  In
that way, the mapping does not have to be changed even if you change the

> Dave

Craig McClanahan

View raw message