What does “Context” in “ServletContext” mean?

前端 未结 6 1855
独厮守ぢ
独厮守ぢ 2021-01-31 11:04

Method getServletContextName() returns the name of the \"web application\". That means, \"ServletContext\" is nothing but \"web application\". Ok.

API defin

6条回答
  •  广开言路
    2021-01-31 11:34

    The name is indeed, IMO, very badly chosen.

    We must read ServletContext as "the general context of a servlet API based web application". Whereas we must read ServletConfig (another standard class) as "The config of a servlet".

    They should IMO have named ServletContext as "WebAppContext" or "ApplicationContext", and ServletConfig as "ServletContext".

    BTW, in JSP, the scope linked to a JspPage is named "page"; the scope linked to a HttpServletRequest is named "request"; the scope named to a HttpSession is named "session", and the scope linked to a ServletContext is named ... "application".

提交回复
热议问题