Is there any differance b/w getting servlet context from
servlet config and session? if yes then what is that?

Answer Posted / sandhya

YES,There is some difference,when we deploy the web
application the web container will create the Context
object and when we load the servlet class then container
will create config object,so for each web application web
container will create one servlet context obj and for each
servlet web container will create servlet config object.

Generally we use this objects to avoid the hardcoding,we
declare this variables in deployment descriptor,we declare
context parameters under web-app tag so that all servlets
can use this parameter values ,and config parameters under
servlet tag so that only specific servlet can use this
parameter values,in simple way context object is like
global object and config obj is like local obj.

Is This Answer Correct ?    8 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the ways to handle multi-threading in servlets?

848


What is cgi?

790


If servlet receives multiple requests, how many objects will it create?

1100


Which interface should be implemented by all servlets?

951


Explain in brief the directory structure of a web application?

814


What are the uses of servlet

841


Differentiate between the print writer and servlet output stream?

763


What is the difference between Servlet Request and Servlet Context when calling a Request Dispatcher?

859


What's the servlet interface?

836


What is servlet name in web xml?

777


Explain the architechure of a servlet?

857


Can filter be used as request or response?

743


What’s the difference between genericservlet and httpservlet?

753


Write a program to show the functionality of doget and dopost method?

904


What is session?

826