Web. XML Memo Summary in Servlet

Source: Internet
Author: User

<?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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.