Web. XML of Java

Source: Internet
Author: User

Web. xml file

Label:

1. <web-app> Top level label, all Web. XML must contain this tag. In this tab, the current servlet version and some other information are described.

2. <servlet> is used to define and servlet related information, including the following four word tags:

<servlet-name>

<servlet-class>

<description>

<display-name>: Provides some GUI tools that may be used to display text information for a servlet

3. <servlet-mapping> The label is typically paired with the <servlet> tag to map the servlet to a user-accessible web path. which

<url-pattern> defines the accessible web path, but be aware that the path must begin with "/". The content in <url-pattern></url-pattern> is just an access path,

You can set this access path to any form, or even to a Web program in another language, as follows:

<url-pattern>/first.php</url-pattern>

<servlet-mapping> and <servlet> are many-to-one relationships, that is, multiple <servlet-mapping> can map a <servlet>, This allows you to define multiple accessible web paths for a servlet.

4.<welcome-file-list>

Note that:<welcome-file> can only be a relative path and cannot be an absolute path.

<welcome-file> can be any form of relative path, but cannot be preceded by "/", which differs from <url-pattern>. (actually remember this is relative path,<url-pattern> not, relative path is not required/start)

Web. XML of Java

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.