aspose file tools*
The moose likes Servlets and the fly likes What if browser request url matches two Url patterns defined in two differnet <servlet mappings> tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "What if browser request url matches two Url patterns defined in two differnet <servlet mappings> tag" Watch "What if browser request url matches two Url patterns defined in two differnet <servlet mappings> tag" New topic
Author

What if browser request url matches two Url patterns defined in two differnet <servlet mappings> tag

Abhineet Kapil
Ranch Hand

Joined: Feb 08, 2010
Posts: 52

Hi

In web.xml


Now the request that comes from browser is >> Http://localhost:8080/MyConfusedApp/test

In such case please tell which servlet will be invoked as the request matches both the url patterns....
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

The URL does not match either pattern


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
kamal preet
Greenhorn

Joined: Sep 11, 2006
Posts: 3
I have taken two servlets with the same url pattern :




And I hit below url on the browser :

http://localhost:8080/ServletTest/test1


In such a scenario when the requested url exactly matches 2 or more url patterns, Container traverses through the web.xml and invokes the last matching servlet.


So in the above case servlet Test1 gets invoked..

Abhineet Kapil
Ranch Hand

Joined: Feb 08, 2010
Posts: 52

Thanks KP
 
Don't get me started about those stupid light bulbs.
 
subject: What if browser request url matches two Url patterns defined in two differnet <servlet mappings> tag