Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet Mapping

 
sree visu
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a doubt regarding the servlet mapping

consider three servlets with their URL pattern

ajax1 servlet *.view
ajax2 servlet /ajaxian/*
ajax3 servlet /myajax/yourajax/*.view

Also if the container is provided with

/ajaxian/javaranch.view

which servlet will be chosen whether ajax1 or ajax2 servlet

thanks in advance
 
Atul Samnerkar
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sree Visu,

For such questions remember the keyword EDiT (Exact, Directory, exTension) This is the sequence in which container will try to map the URL to the servlet.

With this EDiT rule, Directory has precedence over extension. Hence answer is ajax2 servlet /ajaxian/*. Hope this answers your query.

Thanks,
Atul Samnerkar
 
sree visu
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much Atul for your reply
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!