I've done the same thing my self. What you have below looks okay. Are you
sure the servlet class name is right? Including package name and
capitalization? Can you directly access the servlet? Do you have other
mappings to /* or for the servlet? Even just:

<servlet-mapping>
   <servlet-name>router</servlet-name>
   <url-pattern>/router</url-pattern>
</servlet-mapping>

If you have conflicting mappings, I believe only the first is followed. In
your case, you can't have any other mappings for the servlet.

I tested my mappings using the example app that came with tomcat.

I used the mappping of the SnoopServlet:

   <servlet>
        <servlet-name>
            snoop
        </servlet-name>
        <servlet-class>
            SnoopServlet
        </servlet-class>
   </servlet>

to map http://myhost:8080/snoop/reports/ to the snoop servlet

 <servlet-mapping>
            <servlet-name>
                   snoop
                        </servlet-name>
                        <url-pattern>
                         /reports/*
                         </url-pattern>
         </servlet-mapping>

Also mapped the snoop servlet to *.xxx

    <servlet-mapping>
        <servlet-name>
            snoop
        </servlet-name>
        <url-pattern>
                   *.xxx
          </url-pattern>
    </servlet-mapping>

-----Original Message-----
From: Matt Goss [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 03, 2000 12:57 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: servlet mappings???


Hi all,
I'm attempting to map a controller servlet so that any requests go
through it... (the MVC method).
I have a context/application called test that is accessable via the URL
"http://myhost.com/test/". In the web.xml file (in the
"webapps/test/WEB-INF" directory) I put the following mapping:
<servlet>
    <servlet-name>router</servlet-name>
    <servlet-class>router</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>router</servlet-name>
    <url-pattern>/*</urlpattern>
</servlet-mapping>

the idea is that I should be able to request the file test.jsp and have
the router servlet pick up the request (to test for a login)...but the
servlet never gets the request... the test.jsp page just comes right
up.... grrrrr...
I'm requesting it with the URL "http://myhost.com/test/test.jsp".
Any ideas/suggestions???
Matt Goss

Reply via email to