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


Please Help Members By Posting Answers For Below Questions

what is predefined function in java?

535


What do you understand by java?

559


What is the difference between I ++ and ++ I in java?

503


What is a website container?

497


What do you mean by collectors in java 8?

537






What is the largest data type in java?

506


In how many ways we can do exception handling in java?

571


Does isempty check for null?

553


How do you ensure that n threads can access n resources without deadlock?

807


State some situations where exceptions may arise in java?

623


Java openings 3 - 5 years, Lnt Infotech. requirements - core java, J2ee, struts, hibernate Interview Date:- 19 March 2011 Time:- 9:00 AM to 12:00 Pm Interview Location - L & T Infotech, Manapakkam, Chennai Refererral PS NO:- 291649 (Please mention this when u fill the form only then u will be considered for interview) Documents Required:- Latest Resume, Photograph and last 3 payslips Mail me on vasan2211@gmail.com once u appear for interview

2852


I want to persist data of objects for later use. What is the best approach to do so?

587


What is a Null object?

887


Write a program to find the greatest of three numbers in java?

556


What is the effect of keeping a constructor private?

471