This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet as welcome-file does not work

 
Sigrid Kajdan
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I want to have a servlet as a welcome-file (using Tomcat 5.5 and servlet spec 2.4), like this:



The servlet is declared as like this and has several mappings:





But the servlet is not used as a welcome file. I also added a new mapping to context root, but even with that it does not work:



Can anybody help?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't use servlet mappings as welcome files. Welcome files are physical files. What you could do is to make a welcome.jsp and redirect to a servlet in it.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Satou kurinosuke:
You can't use servlet mappings as welcome files. Welcome files are physical files.


Servlet API 2.4 changed that. Welcome files can be servlets now.
 
Sigrid Kajdan
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I read that too, and I'm using servlet 2.4. So, does anybody have an idea why it does not work?
 
Sigrid Kajdan
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

a colleague just found out. It has to be the url-pattern, not the servlet name, but without a slash:

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlet API 2.4 changed that. Welcome files can be servlets now

Oops, my miss, thanks for pointing that out.

The Web server must append each welcome file in the order specified in the deployment descriptor to the partial request and check whether a static resource or servlet in theWAR is mapped to that request URI.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic