This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Context

 
syed askari
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is ServletContext. Why we use it.
 
Todd Sanders
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You use ServletContext if you want your object visible to all the clients of the web application installed in a container. These objects remain there for the life of the application and can be shared with other servlets.
 
James Carman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ServletContext basically represents your web application. This is where your servlets "live." So, as Todd said, you can share data among your servlets by setting attributes on the ServletContext. ServletContext attributes are web application-wide. They are not specific to any one user (for that use HTTPSession attributes). They are not specific to any one request (for that use ServletRequest attributes).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic