Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Mapping and <url-pattern>

 
Simran Dass
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

My web application folder is Questions.


web.xml contains------

<servlet>
<servlet-name>yy</servlet-name>
<servlet-class>Q310_083.Q184Source</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>yy</servlet-name>
<url-pattern>/data/*</url-pattern>
</servlet-mapping>


There is a jsp page index.jsp in Questions/data folder


In the browser when I give the foll URL --

http://localhost:8080/Questions/data/index.jsp


It calls the servlet instead of displaying the index.jsp page. Even if we access a .jsp page does the Container first match with a servlet mapping ? Will the jsp page not be displayed ?

Should not ask this question as I have cleared the exam but I am confused.
 
Vijitha Kumara
Bartender
Pie
Posts: 3930
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even if we access a .jsp page does the Container first match with a servlet mapping ?

Extension match is performed after checking for path mappings. Hence you get this behavior.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic