Which method is used to get a reference to the ServletContext?
- getContext()
- getServletConfig()
- getServletContext()
- init()
The getServletContext() method is used to obtain a reference to the ServletContext. It is typically called within a servlet using the this.getServletContext() or getServletContext() to access the context information.
Loading...
Related Quiz
- To track the creation and destruction of HttpSession objects, the _________ interface is implemented.
- The __________ interface allows objects to be notified of changes in session lifecycle.
- How can a servlet invalidate a cookie that has been sent to the client?
- How does a servlet handle a scenario where it needs to redirect a client to an external website for authentication?
- To apply multiple filters to a single resource, the web.xml file must define a __________ for each filter.