<servlet> <servlet-name>default</servlet-name> <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>0</param-value> </init-param> <init-param> <param-name>listings</param-name> <param-value>false</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet><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>default</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <!-- The mappings for the JSP servlet --> <servlet-mapping> <servlet-name>jsp</servlet-name> <url-pattern>.jsp</url-pattern> <url-pattern>.jspx</url-pattern> </servlet-mapping>
DefaultServlet
由于url-pattern为/,是默认的Servlet,当客户端要求不能匹配其他所有的Servlet时,由该Servlet处理
紧张用于处理静态资源,为了提升做事器性能,对访问文件进行了缓存
JspServlet卖力处理所有的jsp文件要求
根据JSP文件天生对应的Servlet的java代码将java代码编译为java类布局Servlet实例并实行要求