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 ServletContext() and what is its use?

Answer Posted / asif shahzad

1. ServletContext is a window by which a Servlet instance see its environment.

2. ServletContext defines some methods that a Servlet instance can use to communicate with Servlet Container. E.g. To dispatch request, Writing to a log file etc.

3. Servlet Container pass the ServletConfig object to the Servlet instance when calling init(ServletConfig config) method. ServletContext instance reference exist inside the ServletConfig object.

4. Each Web application has only one ServletContext instance. So its a singleton object. If an Servlet Container deploys multiple Apps, each App have its own ServletContext.

Is This Answer Correct ?    98 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

A client sends requests to two different web components. Both of the components access the session. Will they end up using the same session object or different session ?

1089


What is meant by Servlet? What are the parameters of service method?

1060


What is session tracking?

1207


Explain the architechure of a servlet?

1123


Which HTTP method is non-idempotent?

1135


Why doesn’t a servlet include main()? How does it work?

1161


Is servlet a framework?

1043


What methodology can be followed to store more number of objects in a remote server?

2280


What is the difference between the include() and forward() methods?

1084


Explain jsessionid?

1041


The code in a finally clause will never fail to execute, right?

1085


What is getservletcontext?

1075


Is servlet a controller?

1012


What is http servlet in java?

1072


Can you create a deadlock condition on a servlet?

1085