Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the difference between servlet config and servlet
context.

Answer Posted / venkat

1)The "ServletConfig" , Config stands for configuration.it
is about deployment values you have configred for the
servlet.mostly those values which your servlet might want
to access that you dont want to hard-code,like may be a d/b
name.
{one of the reasons you dont want to hard-code"you have to
recompile the entire servlet if you wish to change a single
value},
It is Unique for each servlet(in a layman's language,one
can treat it as local variables to a particular method).
if you wish to change the values,you can do it by modifying
DeploymentDescriptor(in other words:web.xml)

2)ServletContext(they might have named it AppContext
instead of ServletContext):- you have only one
ServletContext for an entire application{NOTE:-.only if the
application is not distributed, in other scenario,you have
one for each JVM}
you can think it as a bulletin-board, where you can
put up messages (called attributes) that other parts of the
application can access.{in a layman's language one can
treat it as a static values}

you can use it to get server info, including the name and
version of the
Container, and the version of the API that’s supported.

Is This Answer Correct ?    16 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When a servlet accepts a call from a client, it receives two objects. What are they?

1189


If my browser does not support cookie, and my server sends a cookie instance what will happen?

1037


What are the functions of an intercepting filter?

885


Once the destroy() method is called by the container, will the servlet be immediately destroyed? What happens to the tasks(threads) that the servlet might be executing at that time?

1205


What do you mean by request dispatcher in servlet? Also explain its methods.

1092


Write a simple servlet program to print the contents of html.

983


How does Cookies work in Servlets?

1119


What is a servlet?

1074


What are different Authentication options available in Servlets.

1009


Is servlet thread safe?

933


How do you find out what client machine is making a request to your servlet

1006


What are the supporting protocol by HttpServlet ?

1112


What is the use of send redirect () method?

1024


If a servlet is not properly initialized, what exception may be thrown?

1115


What is a servlet context?

1086