Do welcome files need to exist?
The welcome file mechanism allows a request to /some/directory/ to be served by the contents of a file like /some/directory/index.html.
If there is a servlet mapped to handle the welcome file, it will be called. So if index.jsp is configured as a welcome file, then a request to /some/directory/ will be passed to the JspServlet mapped at
*.jsp to handle the /some/directory/index.jsp file.
However, the file MUST exist for the welcome file mechanism to work. Even if index.do is defined as a welcome file, then a request to /some/directory/ will not be passed to a servlet handling
*.do for some/directory/index.do UNLESS THE FILE EXISTS.
If you want an index to be served by a servlet, then I suggest you use a filter
to do the redirection. See the WelcomeFilter.java for an example.
Not working with struts actions
If you are trying to use a struts action as a welcome file, you will need to set
redirectWelcome in Default Servelt to
true. The default is for
redirectWelcome to be
false, which means the page will be forwarded to, and the action never called.