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 / shyam

if u want to use any data which is common for all use and
common to all servlet ,that data can be specified as context
parameters in the web.xml as follows.
<context-param>
<param-name>city</param-name>
<param-value>bangalore</param-value>
</context-param>
web container collects data from web.xml and stores that in
servlet context objects as context parameters.
As a developer,you can collect that data form context object
as follows.
String ci=context.getIntParameters("city").
All the servlets will have only one servlet context object
and can be shared with all servlets running in the container.
i.e: one web application will have one servletcontext object.

Is This Answer Correct ?    53 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the drawbacks of cgi?

1039


What is the difference between CGI and Servlet?

1078


What if we pass negative value in load-on-startup?

1282


How can we create deadlock situation in servlet?

1433


What is webservlet?

994


Is it possible to have a constructor inside the servlet?

1014


What is the dispatcher servlet?

986


How the JSP file will be executed on the Server side?

1138


How do servlets work?

1028


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

1059


What is httpservlet and how it is different from genericservlet?

1100


What are different methods of session management in servlets?

1277


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

1083


Write a servlet to upload file on server.

1103


Explains the differences between context.getrequestdispatcher() and request.getrequestdispatcher()?

1027