struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dariusz Wojtas" <>
Subject Re: index.action problem
Date Fri, 29 Dec 2006 20:22:46 GMT
> Wesley Wannemacher wrote:
> > Hello,
> >
> > I have a small problem and was wondering if anyone else has come across
> > it.
> >
> > In Tomcat 5.5 (and possibly other versions), tomcat will check for the
> > existence of a file and if it doesn't exist send out a 404 before it can
> > be handled by struts when it comes to welcome-files...
> >
> > For instance, if I have the following in my web.xml:
> >
> >     <welcome-file-list>
> >       <welcome-file>index.action</welcome-file>
> >     </welcome-file-list>
> >
> > And someone visits a page by hitting the directory (i.e.
> > http://localhost/context-name/) and a valid mapping exists (maybe taking
> > them to index.jsp), tomcat will deliver a 404 error. However, if I make
> > a blank file called 'index.action,' Tomcat will appropriately handle the
> > request by passing it to struts.
> >
> > Has anyone else encountered this? Is there a better solution than making
> > a blank file called index.action?
> >
> > I tried making an index.html file, but I am also learning sitemesh and I
> > am having a heckuva time figuring out how to get sitemesh not to
> > decorate the index.html file.
> Creating an empty index.action file is the right way to do this on
> Tomcat. Different containers have different interpretations of the
> Servlet spec with respect to this area, but Tomcat's interpretation is
> that it should check for a physical file-system resource, even if the
> request URL will be served by a servlet/JSP/whatever.

I think this depends on the level of the servlet specification being in use.
Since Servlet 2.4 it is required that the container examines both
static resources and mapped servlets of the application. In earlier
versions of the spec this was not a requirement.

A quote from the servlet 2.4 final specification, part of chapter 9.10
"Welcome files":
"If a Web container receives a valid partial request, the Web container must
examine the welcome file list defined in the deployment descriptor. The welcome
file list is an ordered list of partial URLs with no trailing or
leading /. 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
the WAR is mapped to that request URI. TheWeb container must send the request
to the first resource in the WAR that matches."

If you have problems with dynamic welcome files, try to "upgrade" your
application to use servlet 2.4 or newer - if possible.

Best regards
  Dariusz Wojtas

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message