Is a JSP page detected by the page extension of .jsp only? Is there any other way it can be detected?
解决方案
JSP pages in Tomcat are handled by a specific servlet that is meant to handle all requests that terminate with .jsp or .jspx in the HTTP request. This configuration exists in the global $CATALINA\conf\web.xml file where one can find the following significant lines. Note that is for Tomcat 6.
JSP Servlet registration
jsp
org.apache.jasper.servlet.JspServlet
fork
false
xpoweredBy
false
3
JSP Servlet URL mapping
jsp
*.jsp
jsp
*.jspx
You could possibly add more URL mappings for other file extensions that are not already mapped to other servlets, in order to trigger the Jasper compiler, that is eventually responsible for translation of the JSP files into corresponding Java servlets, which are then compiled (using the Eclipse JDT compiler, by default). More information on configuring some of the options in the process can be obtained from the Tomcat documentation on configuring Jasper.