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

Single mapping for multiple Servlets

 
hasan khan
Ranch Hand
Posts: 223
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have more than 20 servlets and i dont want to map each and every servlet in web.xml.
is it possible to map multiple servlets by single mapping in web.xml ?
 
shiva viswanathan
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you mean to say that all 20 servlets can be invoked using the same url
pattern . That doesnt make sense

Please explain
 
hasan khan
Ranch Hand
Posts: 223
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no no.

if i have 20 servlet like
MyServlet1.class
MyServlet2.class
MyServlet3.class
...


i want to map them by *.do

and if the request comes for MyServlet1.do it should go to MyServlet1.class
and so on
 
shiva viswanathan
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Hasan ,

I dont think what you are specifying is possible since *.do means anything in the place of *

Since you will specify *.do for all the url patterns , the container cannot differentiate . In this case i think it will depend on the order of the servlet mappings in the DD . The first occurance of url pattern will be called

Hope this helps

Shiva
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic