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
Explain jsessionid and when is it created?
Which http method is said to be non-idempotent and idempotent?
Write a program to show the functionality of doget and dopost method?
What are the types of servlets? Explain
Tell the new features added in servletrequest interface i.e. Servlet 2.4
How can you start a jta transaction from a servlet deployed on jboss?
What is a web application and what is it’s directory structure?
What is cgi and what are its drawbacks?
request parameter how to find whether a parameter exists in the request object?
When servlet is loaded?
How servlets are deployed in java?
What are the servlet events?
What is the difference in between the httpservlet and generic servlet?
What do you mean by url pattern in servlet?
How do you deal property files in servlet?