In the request header of the HTTP protocol, get the resource to access, find the Web. XML file to find the corresponding servelet
the life cycle of Sevlet
Servletwhen first accessed, the server creates aServletobject that will be called directly after the object is created.Initmethod to initialize, the object that is created will always reside in memory for thisServletaccess to the service, every time to thisServletAccess will result inServicemethod is executed whenWebWhen the application is removed from the container or when the server is shut down,Webdestruction of the applicationServletWill be destroyed, and the server will callServletof theDestroymethods to do some aftercare work
Each time the service () method is invoked, two parameters are passed in:Request object,Response Object
The request object contains the http header and the entity content
the Response object is empty
Call the getwriter (). Write () method of the Response object , toward Response object to write the contents of
The server organizes the contents of the Response object into the Http protocol and returns it to the browser
the inheritance structure of the Servlet
Servlet-Interface defines the basic method that a servlet should have
| -- Genericservlet General Basic Servlet realize, put Service method is designed as an abstract method, which requires subclasses to implement
| -- HttpServlet implemented in the parent class. Service method to determine the current request, call the corresponding doxxx method that requires subclasses to inherit and overwrite the corresponding doget () or doPost () Method
details of the Servlet
A <servlet> can correspond to multiple <servlet-mapping>
<url-partten> can use the * match character, due to the introduction of * , it is possible that a path is multiple Url-partten match, Priority: which is most likely to be found,*. the suffix has the lowest priority
Under <servlet> can be configured <load-on-start-up> can be used to specify the boot order
[Java EE] The invocation process and life cycle of the servlet