1. Context: When a web container is started, it creates a corresponding ServletContext object for each web order, representing the current web application. Function: obtains shared data from the memory of a Web application, accesses static resources of a web application, and communicates between Servlet objects through the ServletContext object. 2 The following interface method uses ServletContext application = this in Servlet. getServletContext (); common methods for obtaining the context object application context are as follows: getInitParameter (String name) getResourceAsStream (String path) the input stream returns the resource corresponding to the path. The path parameter must use "/" getInitParameterNames () to obtain the names of all initialization parameters. The returned result is an enumerated value getRequestDispatcher (String name) get RequestDispatcher object setAttribute () based on the forwarded address set the attribute value getAttribute () Get the attribute value getAttributeNames () Get all attribute value names 3 The context parameter is in the web. configure initialization parameters in xml: <context-param> <param-name> adminEmail </param-name> <param-value> webmaster </param-value> <context-param> element for the entire application, therefore, it is not nested in a <servlet> element. This element is a direct sub-element of the <web-app> element. Access the initialization parameter from Servlet: ServletContext application = this. getServletContext (); application. getInitParameter ("email"); 4 context attribute ServletContext application = this. getServletContext (); application. setAttribute ("name", "value"); application. getAttribute ("name"); Enumberation p = application. getAttributeNames ();