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
How is an application exception handling is done using a servlet?
What is the difference between the getrequestdispatcher(string path) method of javax.servlet.servletrequest interface and javax.servlet.servletcontext interface?
What’s the use of the servlet wrapper classes??
Describe the phases of servlet lifecycle?
How we can create war file in servlet?
What are the various ways of session supervision in servlets?
What is servlet collaboration?
How do you design microservices?
How do you deal property files in servlet?
Which event is fired at the time of project deployment and undeployment?
Why is servlet used?
What is servlet interface?
What are the type of protocols used in httpservlet?
Why is init() method is used in servlets?
What is the disadvantage of cookies?