The development of the Dynamic web module version 3.1 In the eclipse environment simplifies the configuration of Servlet classes in Dynamic web objects, without the need for web. xml configuration & lt; Servlet & gt ;,

Source: Internet
Author: User

The development of the Dynamic web module version 3.1 In the eclipse environment simplifies the configuration of Servlet classes in Dynamic web objects without web. xml configuration. <Servlet>,

Before the eclipse environment Dynamic web module version 3.1, configure the Servlet class in the Dynamic web object in web. xml. The image and Code are as follows:

The source code in web. xml is as follows:

<? Xml version = "1.0" encoding = "UTF-8"?>
<Web-app xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
Xmlns = "http://xmlns.jcp.org/xml/ns/javaee"
Xsi: schemaLocation = "http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
Id = "WebApp_ID" version = "3.1">
<Display-name> ServletDemo </display-name>
<Welcome-file-list>
<Welcome-file> index.html </welcome-file>
<Welcome-file> index.htm </welcome-file>
<Welcome-file> index. jsp </welcome-file>
<Welcome-file> default.html </welcome-file>
<Welcome-file> default.htm </welcome-file>
<Welcome-file> default. jsp </welcome-file>
</Welcome-file-list>
<Servlet>
<Servlet-name> ServletDemo </servlet-name> <! -- Dynamic web object name -->
<Servlet-class> com. swift. servlet. ServletTest </servlet-class> <! -- Name of the newly created Servlet class in the src folder -->
</Servlet>
<Servlet-mapping>
<Servlet-name> ServletDemo </servlet-name> <! -- Dynamic web object name -->
<Url-pattern>/ServletTest </url-pattern> <! -- Everything can be done here. Do not forget that there is a forward slash/URL path on the last side -->
</Servlet-mapping>
</Web-app>

In the eclipse environment, after the Dynamic web module version 3.1, the Servlet class configuration in the Dynamic web object does not need to be configured in web. xml <Servlet>. The times have improved.

 

You don't need to do anything. The following sentence is all done. ().

@ WebServlet ("/ServletTest ")

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.