• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubt regarding how to specify servlet mapping URL patterns in web.xml

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Didn't know exactly which forum to post this query in. So here I am.

I am using a spring controller in my web application.
In the web.xml I want to configure all URLs to be handled by the spring dispatcher servlet. I have tried below thing but it doesn't work:



However, if i specify a different <servlet-mapping> element for each URL pattern it works. For example,



I am using SimpleURL Handler Mapping in Spring for handling URLs.


Am not able to figure out why /* doesnt work. As of now, if I have to mention a separate servlet mapping for each url, then things get unwieldy as the no. of urls increase..

 
Anoop Nair
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I solved this by specifying the below servlet-mapping in web.xml



I replaced the /* with just / .

But now I have another problem.

Previously, for all my static content (like .gif, .jpg, .css etc..) I was specifying


But now I have to specify a different mapping for each one of them.

Can someone please tell as to why this is happening ?? Also is this the best way to do or is there a better way ???
reply
    Bookmark Topic Watch Topic
  • New Topic