File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Abhineet Kapil
Ranch Hand
Posts: 52
Eclipse IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The URL does not match either pattern
 
kamal preet
Greenhorn
Posts: 3
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 52
Eclipse IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks KP
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic