Relationship and differences with the applicaiton of ServletContext

Relationship and differences with the applicaiton of ServletContext.

  1. servletcontext mainly used in the servlet and jsp used;
  2. jsp application can only be used in the page;
  3. application and servletcontext global container are stored information;
  4. application is in packaging applications servletcontext jsp, so they are actually the same object is represented, with application attribute stored servletcontext can be read, and vice versa;
  5. Jsp can be used directly in the application, the object may be obtained by servletcontext GetServletContext () method, and the application of this object to use exactly the same;
  6. 不懂之处:You can not use applicaiton in <%!%>, But you can use the ServletContext. Methods as below:
	ServletContext application = getServletContext();
Published 22 original articles · won praise 0 · Views 147

Guess you like

Origin blog.csdn.net/weixin_42649617/article/details/104864574