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 is a servlet?
What is the major difference between servlet and applet?
What is java servlet session?
What’s the difference between genericservlet and httpservlet?
What does the term localization refer to?
How do you run a servlet?
What are the phases of servlet life cycle?
Why do we have servlet filters?
What is string tokenizer?
What are all the protocols supported by httpservlet?
Define context initialization parameters.
When to use doget() and when dopost()?
What is servlet configuration?
What are the disadvantages of storing session state in cookies?
When Servlet is unloaded?