A servlet instance (servlet instance) must first be defined in the servlet web.xml file in the Web.xml file, and then map this instance to one or more URL Patterns.
1. Define the servlet instance: element defines a servlet instance. The element must contain and two sub-elements, or other initialization parameters may also be included. element defines the unique name of the servlet instance. Each servlet instance must have a unique name, which is only used to match the URL mapping of this instance, so it is not necessary to consistent with the servlet class or servlet's URL. element tells the Servlet container how to build an instance of a servlet class. The element contains two parts, contains the class name of the servlet, and the class name of the Servlet class. For example: getStatus servlet-name> status.createstatusservlet servlet-class> servlet> Due to the name of the Servlet instance does not have to match the class name of the Servlet class. To load another instance of the same servlet class into a container, just another servlet instance name. For example: getStatus servlet-name> status.createstatusservlet servlet-class> servlet>
fullstatus servlet-name> status.createstatusservlet servlet-class> servlet> Each element is also available to any number of element. The container passes the parameters to their respective servlets. Like the command line parameters, the individual servlets require their respective parameter names and parameter values. E.g:
getStatus servlet-name> status.createstatusservlet servlet-class> Output param-name> Brief param-value> init-param> servlet>
fullstatus servlet-name> status.createstatusservlet servlet-class> Output param-name> Verbose param-value> init-param> servlet> A element can only define a servlet instance. In order to transfer the container to the servlet, a servlet must be mapped to one or more URLs or calls the names of other servlets or filters through this servlet.