what is difference between servletconfig and servletcontext?
Answer Posted / p.nandakishore
ServletConfig and ServletContext are interfaces in
javax.servlet package
ServletConfig is one per one Servlet.Each servlet as its
own ServletConfig object.The ServletConfig object is
provided by the Container during the initialization phase
of the Servlet.ServletConfig object can be user to read
initialization parameters into the Servlet from web.xml.
ServletContext is one per one web-application.All servlets
which are in a web-application have common ServletContext.
ServletContext can be used to communicate the Servlet with
the ServletContainer.It can also be used to read
initialization parameters from web.xml.It can be used to
share some resources between servlets which are in a web-
application.(resources like Connection object)
| Is This Answer Correct ? | 16 Yes | 0 No |
Post New Answer View All Answers
Which method returns the length of a string?
What is immutable class in java?
How to handle a web browser resize operation?
What advantage do java's layout managers provide over traditional windowing systems?
What is an example of a conditional statement?
Difference between == and .equals() ?
Why do we need variables?
Can a boolean be null java?
Can a method be overloaded based on different return type but same argument type?
What are the different types of inheritance in java?
Differentiate between static and non-static methods in java.
Can a class extend 2 classes in java?
Is string a wrapper class?
What is not thread safe?
What are exception handling keywords in java?