How is the ServletContext obtained in a servlet?
- Using the getServletConfig() method of the HttpServletRequest object.
- Using the getServletConfig() method of the ServletContext object.
- Using the getServletContext() method of the HttpServletRequest object.
- Using the getServletContext() method of the ServletConfig object.
The getServletContext() method of the HttpServletRequest object is used to obtain the ServletContext in a servlet.
Loading...
Related Quiz
- What is the main purpose of using try-catch blocks in database operations?
- In a servlet, how can you log an exception along with the stack trace?
- In a servlet, how can you retrieve parameters sent via the POST method?
- How can you retrieve a servlet's initialization parameters in the init method?
- Servlets can be made thread-safe by making shared resources __________.