react性能優(yōu)化方法 ServletContext作用是什么,怎么用?
ServletContext作用是什么,怎么用?當(dāng)web容器啟動時(shí),它將為每個(gè)web應(yīng)用程序創(chuàng)建對應(yīng)的ServletContext對象,該對象表示當(dāng)前web應(yīng)用程序。ServletContext對象的
ServletContext作用是什么,怎么用?
當(dāng)web容器啟動時(shí),它將為每個(gè)web應(yīng)用程序創(chuàng)建對應(yīng)的ServletContext對象,該對象表示當(dāng)前web應(yīng)用程序。
ServletContext對象的引用在ServletConfig對象中維護(hù)。當(dāng)開發(fā)人員編寫servlet時(shí),他們可以使用ServletConfig.getServletContext方法來獲取ServletContext對象。由于web應(yīng)用程序中的所有servlet共享同一個(gè)ServletContext對象,因此可以通過ServletContext對象實(shí)現(xiàn)servlet之間的通信。ServletContext對象也稱為上下文域?qū)ο蟆?/p>