what is difference between servletconfig and servletcontext?

Answers were Sorted based on User's Feedback



what is difference between servletconfig and servletcontext?..

Answer / 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

what is difference between servletconfig and servletcontext?..

Answer / suganthi

Servlet Config: Servlet config is Unique for every Servlet.

Servlet Context: Servlet Context is same for all the Servlet.

Is This Answer Correct ?    4 Yes 0 No

what is difference between servletconfig and servletcontext?..

Answer / dileep

1.servletconfig is nothing but per one servlet and servlet
context is nothing but per entier web Application.

Is This Answer Correct ?    5 Yes 2 No

Post New Answer

More Core Java Interview Questions

What is string pooling concept?

0 Answers  


Why Java is called as purely platform independent..? Explain briefly..dont Give regular answers Explain with your own example..?

8 Answers   Nokia,


How are this() and super() used with constructors?

9 Answers  


How to instantiate member inner class?

0 Answers  


What are the parts of a method?

0 Answers  






What are the loops in java?

0 Answers  


Explain Stream Tokenizer?

4 Answers  


How does system arraycopy work in java?

0 Answers  


What are aggregate functions explain with examples?

0 Answers  


what is the purpose of method overriding in java where v r completely re-defining a inherited method instead y can't v create a new method and define.If the question is very silly plz excuse me and do reply.Thank U!

7 Answers   emc2, Kumaran Systems,


Is special character in java?

0 Answers  


How to print nodes of a Binary tree?

1 Answers   TCS,


Categories