So, the spec states that JSP-enabled containers must (implicitly) map URLs matching "*.jsp" to a Servlet (or whatever) that is able to handle parsing av rendering a .jsp page. How it is implemented, however, is up to the container in question.
I've therefore done some research on my dev servers, Tomcat and Jetty, to see how it's done there. Tomcat has an xml-file in TOMCAT_HOME/conf/web.xml, which is parsed before your application's own web.xml, thus providing reasonable "defaults". This is from the start of conf/web.xml:
Code:
<!-- ======================== Introduction ============================== -->
<!-- This document defines default values for *all* web applications -->
<!-- loaded into this instance of Tomcat. As each application is -->
<!-- deployed, this file is processed, followed by the -->
<!-- "/WEB-INF/web.xml" deployment descriptor from your own -->
<!-- applications. -->
Somewhat further down in the file, I found this:
Code:
<!-- The JSP page compiler and execution servlet, which is the mechanism -->
<!-- used by Tomcat to support JSP pages. Traditionally, this servlet -->
<!-- is mapped to the URL pattern "*.jsp". -->
(...)
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
(...)
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jspx</url-pattern>
</servlet-mapping>
And it turns out that Jetty has more or less the same configuration, except that the "default" file is named JETTY_HOME/etc/webdefault.xml instead. Both use the class org.apache.jasper.servlet.JspServlet, found in jasper-compiler.jar.
Seeing as JBoss bundles Tomcat or Jetty, I would assume that this jar/class is present there as well, providing for a somewhat less container-dependent mapping configuration than I had initially feared. I don't know if other application servers use Jasper for comiling JSP files, though.
Anyways, I tried copy/pasting this configuration over to my own web.xml. But that didn't work too well, as it seems "/*" has higher precedence than "*.jsp". So I took a new look at the Servlet spec, only to find out that the "default pattern" is "/", not "/*". I changed DispatcherServlet's mapping from /* to just /, and then it worked. Out of curiousity, I then removed the explicit *.jsp mapping (to Jasper's JspServlet) to see if that would work as well. And it did.
So, dear Jeroen and andrew - the solution is to map DispatcherServlet with "/" instead of "/*". That's all. Doh!