listener-Listener +servletcontext+applicationcontext

Source: Internet
Author: User

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

Related Article

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.