1用于保存整个WebApplication的生命周期内都可以访问的数据,任何客户端,任何浏览器都可以访问。
2在API中表现为ServletContext
3通过HttpServlet的getServletContext方法可以拿到,因为sevlet本身就extends HttpServlet,所以可以直接通过
ServletContext application =this.getServletContex();
4通过ServletContext的get/setAttribute方法取得/设置相关属性
本文介绍了应用上下文(ServletContext)的概念,它是如何在整个Web应用程序的生命周期中保持数据的,以及如何通过HttpServlet的getServletContext方法获取它。此外还讲解了如何使用ServletContext的get/setAttribute方法来读取和设置属性。
164

被折叠的 条评论
为什么被折叠?



