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>