Spring uses ServletContext on JSP pages

Source: Internet
Author: User

Use Application on JSP pages

You can see that the webapplicationcontextutils is used

Instead of Webapplicationcontext.root_web_application_context_attribute like

1. Get an instance of the IOC container from the application domain object
ApplicationContext context = webapplicationcontextutils.getwebapplicationcontext (application);
2. Getting beans from the IOC container
......
3. Using beans

.......

This is really strange, because in the Web. xml file I put the IOC container in the webapplicationcontext.root_web_application_context_attribute

Xml

Org.springframework.web.context.ContextLoaderListener: The Initwebapplicationcontext method is called in this class

Org.springframework.web.context.comntextLoader in this method, you can see that the context is put into the webapplicationcontext.root_web_ Application_context_attribute

However, you can see that the webapplicationcontextutils is used in the JSP page

After viewing the discovery returned is webapplicationcontext.root_web_application_context_attribute

Well, that's a match for our certification.

Spring uses ServletContext on JSP pages

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.