Resources
What's the difference between ServletContext and ApplicationContext?
ServletContext: is a web container of things, a webapp, more than the scope of the session, from which you can get a lot of information, such as the path directory of the project deployment ,
initialization parameters of the project, you can also setattribute into the same usage as the session, but notice the scope
Role:
applicationcontext: Spring is something that spring is reading from this XML configuration file to the new Bean's
(Apply context Relationship)
Role: (1) Read Bean configuration file, manage bean load, instantiate, maintain dependency between beans, responsible for bean's periodic declaration
(2) Provide complete framework functions such as: A. Internationalization Support B. Resource access: Resource rs = ctx. GetResource ("Classpath:config.properties"),
"File:c:/config.properties" C. Event delivery: By implementing the Applicationcontextaware interface
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||
Similarities and differences of ServletContext and application
The two are essentially the same, equivalent to creating 2 different names of variables.
ServletContext is the Application object in the servlet.
ServletContext application = null;
application = Pagecontext.getservletcontext ();
Difference:
The difference between the two is that application is used in JSPs, and ServletContext is used in Servlets. Application and Page
The request session is a built-in object in the JSP, and the property data stored in the background with ServletContext can be
The Application object is obtained.
listener-Listener +servletcontext+applicationcontext