This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Servlets and the fly likes Inter-servlet communication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Inter-servlet communication" Watch "Inter-servlet communication" New topic
Author

Inter-servlet communication

Gareth Western
Ranch Hand

Joined: Apr 07, 2004
Posts: 45
Hi all,
I've written a servlet which adds an object to a new attribute in the ServletContext. What are the conditions to be able to access that ServletContext from a different servlet?
Cheers!
Gareth
Abdul Narayan D'souza TP
Greenhorn

Joined: Apr 01, 2004
Posts: 10
Yo Gareth,
There is one context per "web application" per Java Virtual
Machine.Therefore whenever u call ServletConfig.getServletContext() from
any servlet in an application(context) u get the same object.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Inter-servlet communication