Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Anoop Nair
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • 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
  • 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 ???
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic