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
What is the process for chaining servlet?
Write a hello world program using servlets.
What are the different mode that servlets can be used?
How to get ip address in jsp login page and how to validate like 127.1.0.1 all should not be greater than 255
Why do we use sendredirect() method?
Write all the phases defined in servlet life cycle?
what is the different between a servlet and a cgi? Why do you go for servlet rather than cgi?
How servlets are deployed in java?
Is servlet a framework?
Whether we can get deadlock situation in servlets?
Explain servlet events?
Who is responsible for writing a constructor?
What are the different ways we can maintain state between requests?
What do you mean by the servlet chaining?
What is servlet and its advantages?