Analysis of Web.xml in Hello1 project
一、web.xml文件介绍 The web.xml file contains several elements that are required for a Facelets application. All of the following are created automatically when you use NetBeans IDE to create an application. web.xml文件的作用 web.xml主要用来配置Filter、Listener、Servlet等。但是要说明的是web.xml并不是必须的,一个web工程可以没有web.xml文件。 WEB容器的加载过程 WEB容器的加载顺序是: ServletContext -> context-param -> listener -> filter -> servlet。在web.xml文件中最好按照这种顺序配置这些元素,以兼容较低版本的Tomcat。 WEB容器的启动过程 WEB容器启动时,加载过程顺序如下: 启动一个WEB项目的时候,WEB容器会去读取它的配置文件web.xml,读取<listener>和<context-param>两个结点。 紧急着,容创建一个ServletContext(servlet上下文),这个web项目的所有部分都将共享这个上下文。 容器将<context