This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes servlet as welcome-file does not work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet as welcome-file does not work" Watch "servlet as welcome-file does not work" New topic
Author

servlet as welcome-file does not work

Sigrid Kajdan
Ranch Hand

Joined: Jan 14, 2007
Posts: 72
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

Joined: Nov 24, 2005
Posts: 14687
    
  16

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.


[My Blog]
All roads lead to JavaRanch
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41129
    
  45
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.


Ping & DNS - my free Android networking tools app
Sigrid Kajdan
Ranch Hand

Joined: Jan 14, 2007
Posts: 72
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

Joined: Jan 14, 2007
Posts: 72
Hello,

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

Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlet as welcome-file does not work
 
Similar Threads
jstl problem in Spring MVC
welcome-file-list... A BUG?
servlet deployment error in web.xml on WSAD 4.x
Servlets 2.4: Mapping the root path exclusively?
Servlet as a welcome file