Is there any differance b/w getting servlet context from
servlet config and session? if yes then what is that?
Answer Posted / rajendra singh bisht
You can get reference to ServletContext through ServletConfig. HttpSession does not provide a reference to ServletContext object.
To get a ServletContext object use
getServletConfig().getServletContext();
or you can call directly getServletContext() bcoz GenericServlet class implements ServletConfig interface also.
Is This Answer Correct ? | 4 Yes | 3 No |
Post New Answer View All Answers
What are the types of an http request?
Which method of the httpservletrequest object is used?
When servlet is loaded?
Explain the methods of request dispatcher in servlet?
List some life cycle methods of a servlet.
Explain the difference between get and post method in servlet?
What is cgi and what are its drawbacks?
What are the exceptions thrown by servlets? Why?
How do you find out what client machine is making a request to your servlet
how many jsp scripting elements are there and what are those?
Write all the phases defined in servlet life cycle?
How we can get ip address of client in servlet?
Explain the jar and war files in servlet?
What are the life-cycle methods for a servlet?
Can we use threads in Servlets?