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