The following web.xml doesn’t seem to work:
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>*.wfn</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>SelectSessionServer.wfn</welcome-file>
</welcome-file-list>
Instead, a directory listing is shown. I have an index.html file in there, and that index.html file has a link to exactly the same SelectSessionServer URL, and then it works properly.
(“it” = Glassfish & Tomcat)
How come ?
I’ve seen this question ( servlet as welcome-file-list in tomcat 7 ) and its responses seem to suggest that my setup should be working.
Make sure that your
web.xmlroot declaration conforms Servlet 3.0 in order to map a servlet on a welcome file. You’re using Tomcat 7 and (supposedly) Glassfish 3, which are Servlet 3.0 containers, so you should make sure that yourweb.xmlis also declared as such.It’ll also give additional benefits of new Servlet 3.0 features such as
@WebServletannotation and so on.