wood burning stoves*
The moose likes Spring and the fly likes Doubt regarding how to specify servlet mapping URL patterns in web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Doubt regarding how to specify servlet mapping URL patterns in web.xml " Watch "Doubt regarding how to specify servlet mapping URL patterns in web.xml " New topic
Author

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

Anoop Nair
Ranch Hand

Joined: Oct 29, 2008
Posts: 70
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

Joined: Oct 29, 2008
Posts: 70
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 ???
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt regarding how to specify servlet mapping URL patterns in web.xml
 
Similar Threads
Cannot call Spring WS
Spring MVC - no ContextLoaderListener registered
BeanDefinitionStoreException when running Spring web app
Bridge between REST & WS
[SOLVED] images fail to load in spring2.5/tiles2