The Eclipse Environment Dynamic Web Module version 3.1 is progressing to simplify the configuration of the Servlet class in Dynamic Web Object without Web. XML Configuration <Servlet>

Source: Internet
Author: User

Before the Eclipse Environment Dynamic Web Module version 3.1, the configuration of the Servlet class in Dynamic Web object, to be in the XML config <Servlet> picture and code is 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> <!--new Servlet class name in the SRC folder--
</servlet>
<servlet-mapping>
<servlet-name>ServletDemo</servlet-name> <!--Dynamic Web object name--
<url-pattern>/ServletTest</url-pattern> <!--Here's something, don't forget to have a slash/URL path on the last side -
</servlet-mapping>
</web-app>

After the Eclipse Environment Dynamic Web Module version 3.1, the configuration of the Servlet class in Dynamic Web object does not need to be configured <Servlet> in XML. The Times have progressed again.

Nothing to do, the following sentence is all done. () in the parameter is the URL path is arbitrarily specified, access to the use of the

@WebServlet ("/servlettest")

The Eclipse Environment Dynamic Web Module version 3.1 is progressing to simplify the configuration of the Servlet class in Dynamic Web Object without Web. XML Configuration <Servlet>

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.