Javaweb Learning Summary _servlet Development

Source: Internet
Author: User

I. Introduction of the Servlet

Second, the operation of the servlet process

The servlet program is called by the Web server after the Web server receives a servlet access request from the client:

    1. The Web server first checks to see if the instance object for the servlet has been mounted and created. If so, perform step 4th directly, or step 2nd.
    2. Mount and create the init () method for the Servlet instance object
    3. Invoking the Init () method of the Servlet instance object
    4. Create a HttpServletRequest object that encapsulates the HTTP request message and a HttpServletResponse object that represents the HTTP corresponding message, and then call the servlet's service () method, and the request and response objects are passed in as parameters.
    5. Before the Web application is stopped or restarted, the servlet engine uninstalls the servlet and invokes the servlet's Destory () method

Third, servlet call graph

Iv. servlet Access URL mapping configuration

The same servlet can be mapped to multiple URLs, that is, the set value of the <servlet-name> child elements of multiple <servlet-mapping> elements can be the registered name of the same servlet

<servlet> <description></description> <display-name>servletdemo1</display-name&gt        ; <servlet-name>ServletDemo1</servlet-name> <servlet-class>com.atguigu.servlet.servletdemo1</servlet-class> </servlet> <!--the same servlet can be mapped to multiple URLs--<servlet-mapping> <servlet-name>    Servletdemo1</servlet-name> <url-pattern>/servletDemo1</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>ServletDemo1</servlet-name> <url-pattern>/1.html& lt;/url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>servletdemo1</ser        vlet-name> <url-pattern>/2.htm</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>ServletDemo1</servlet-name> <url-pattern>/3.htm</url-pattern> </ Servlet-mapping>

Javaweb Learning Summary _servlet Development

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.