/ * 1. specific request path: [address] If the resource file with the current browser requests a Servlet <url-pattern> [content] exactly the same, Tomcat will be invoked with the current Servlet examples OneServlet <url-pattern> / one .do </ url-pattern> HTTP: // localhost : 8080 / myWeb / one.do OneServelt is called HTTP: // localhost : 8080 / myWeb / abc / one.do OneServelt not be called [Note]: specific request path must be "/" beginning with 2. precondition request path: If a browser requests a resource file [] in order to address the current Servelt the <url-pattern> content to begin with. Tomcat Servlet will band called the current example OneServlet <url-pattern> / abc / * </ url-pattern> "*": is a wildcard description is an arbitrary length string if the current resource file [address] is "/ abc / "as the beginning, it means the call resource OneServlet HTTP:: 8080 / myWeb / abc / two.do OneServelt is called HTTP: // localhost : 8080 / myWeb / abc / one.html OneServelt will be called [Note]: specific request path must be "/" as the beginning, must "*" and ending request path 3. postcondition: When the browser requests a resource file [address] to the current Servelt <url-pattern> content for ending. Tomcat Servlet will band called the current example OneServlet <url-pattern> * do </ url-pattern>. HTTP: // localhost : 555 / myWeb / abc / one.do OneServelt is called HTTP: // localhost : 555 / myWeb / five.do OneServelt is called HTTP: // localhost : 555 / myWeb / five.do uname = Mike OneServelt will be called, because by reading tomcat url to locate the servlet? request line: [ url: HTTP: localhost // : 555 / myWeb / five.do Methos: GET ] request header: [ the uname: Mike ] [Note]: can not "/" is beginning to be "*" to the beginning of the request 4. wildcard path: current Servlet may receive a request for all current websites example OneServlet < pattern-URL> / * </ URL-pattern> HTTP: // localhost : 555 / myWeb / mm.jpg OneServlet HTTP: // localhost : 555 / myWeb / one.do OneServlet 5. The path priority request: [specific request path]> [preconditions]> [wildcard]> [postcondition] HTTP: // localhost : 555 / myWeb / ABC / one.do OneServlet: <URL-pattern> /abc/one.do </ url- pattern> TwoServlet <URL-pattern>/abc/*</url-pattern> ThreeServlet <url-pattern>*.do</url-pattern> FourServlet <url-pattern>/*</url-pattern> */
About Priority: tomcat i.e. to find the corresponding web.xml Servlet url acquired according to respond to the request.
If in accordance with the specific request path [] there is a match, then the corresponding direct call Servlet, then [Preconditions] contrary to match, and so on
Life cycle
/ * Servlet life cycle instance object [] 1. The project, all objects are responsible for Servlet examples created by the Tomcat; developers have no right to create an instance of Servlet 2. [create] the time: 1) [default]: When when the first user to access this Servlet, Tomcat is responsible for creating its instance object 2) [human intervention]: Tomcat requirements at startup, create an instance of the Servlet <the servlet> <the servlet-name> TwoServlet </ the servlet-name> <the servlet-class> com.bjpowernode.controller.TwoServlet </ the servlet-class> <Load-oN-Startup> 890 </ Load-oN-Startup> </ the servlet> 3. during operation Tomcat, a Servlet implementation class only You can create an instance of the object 4.When Tomcat is closed, the Tomcat Servlet responsible for the destruction of all instances of an object * /