2

Configuring servlets in web.xml usually follows this pattern:

http://www.mydomain.com/servletName/some/path/here

What configuration do I use if I want all requests to go to the same servlet?

http://www.mydomain.com/some/path/here
Tony the Pony
  • 40,327
  • 71
  • 187
  • 281
  • 4
    So, you basically want a front controller? This may be helpful: http://stackoverflow.com/questions/3541077/design-patterns-web-based-applications/ Note that having a servlet on `/*` is a poor idea. How about requests on static content like img/css/js? This may be helpful as well then: http://stackoverflow.com/questions/870150/how-to-access-static-resources-when-using-default-servlet/3593513#3593513 – BalusC Apr 21 '11 at 14:23
  • Thanks, and +1 also for your answer there... – Tony the Pony Apr 21 '11 at 14:29

1 Answers1

9

Point your <url-pattern> in web.xml to your servlet like so:

<servlet-mapping>
        <servlet-name>myservlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228