<?xml version= "1.0" encoding= "UTF-8"?>
<web-app version= "2.4"
Xmlns= "HTTP://JAVA.SUN.COM/XML/NS/J2EE"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
Xsi:schemalocation= "Http://java.sun.com/xml/ns/j2ee
Http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ">
<icon>
<small-icon>/images/app_small.gif</small-icon>
<large-icon>/images/app_large.gif</large-icon>
</icon>
/*
Icon: Specify large icons and small icons for Web applications
*/
<display-name>tomcat example</display-name> //web app name
<disciption>tomcat Example servlets and JSP pages.</disciption> //web Application Description
<init-param>//servlet-scoped parameters obtained via This.getinitparameter ("param1")
<param-name>data2</param-name>
<param-value>YYYYYYYYYYYYY</param-value>
</init-param>
<context-param> //application parameters within the range, stored in ServletContext (typically in spring)Getservletcontext (). Getinitparameter ("Context/param") obtained
<param-name>ContextParameter</para-name>
<param-value>test</param-value>
<description>it is a test parameter.</description>
</context-param>
<servlet>
<servlet-name>ServletDemo</servlet-name> //Specify servlet name
<servlet-class>com.bird.servlet.ServletDemo</servlet-class>//Specify the path where the servlet is located
/*
This means that the servlet at web-inf/classes/Com/bird/servlet/servletdemo has been registered with the name Servletdemo. Giving the servlet a name has two main meanings. First, the initialization parameters, the custom URL pattern, and other customizations refer to this servlet through this registration name instead of the class name. Second, you can use this name in a URL instead of a class name
*/
<load-on-startup>1</load-on-startup>//Server startup is whether to load this servlet,0: Do not load other numbers in order to load the numbers
</servlet>
<servlet-mapping>//URL Access mapping mode, the following url-pattern to get a matching pattern to find the appropriate servlet processor
<servlet-name>ServletDemo</servlet-name>
<url-pattern>*do</url-pattern>
</servlet-mapping>
<session-config>//Control session timeout (in minutes)
<session-timeout>180</session-timeout>
</session-config>
<error-page> //Specify error page location by error code configuration
<error-code>404</error-code>
<location>/NotFound.jsp</location>
</error-page>
MIME type configuration
<mime-mapping>
<extension>htm</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
Resource Factory configuration
<resource-ref>
<res-ref-name>mail/Session</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Container</res-auth>
</resource-ref>
The configuration database connection pool can be configured here:
<resource-ref>
<description>jndi JDBC DataSource of shop</description>
<res-ref-name>jdbc/sample_db</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<welcome-file-list>