zoukankan      html  css  js  c++  java
  • Servlets are controlled by the Container

    A:  User clicks a link that has a URL to a servlet.

    B: The Container "sees" that the request is for a servlet, so the container creates two objects:

      1) HttpServletsResponse

      2) HttpServletRequest

    C: The Container finds the correct servlet based on the URL in the request, creates or allocates a thread for that request, and calls the servlet`s service() method, passing the request and response objects as arguments.

    D: The service() method figures out which servlet method to call based on the HTTP Method(GET,POST,etc) sent by the client.

    E: The servlet uses the response object to write out the response to the client . The client sent an HTTP GET request ,so the service() method calls the servlet`s doGet() method,passing the request and response objects as arguments.


    F: The servlet uses the response object to write out the response to the client. The response goes back through the Container.

    G: The service() method completes ,so the thread either dies or returns to a Container-managed thread pool. the request and response object references fall out of scope, so these objects are toast.  The client gets the response.



  • 相关阅读:
    MySQL学习笔记:coalesce
    Oracle学习笔记:decode函数
    MySQL学习笔记:like和regexp的区别
    状态图
    构件图和部署图
    java基础知识(一)
    包图
    活动图
    协作图
    序列图
  • 原文地址:https://www.cnblogs.com/wrh526/p/2159273.html
Copyright © 2011-2022 走看看