This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Sharing Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Sharing Objects " Watch "Sharing Objects " New topic
Author

Sharing Objects

Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
if i want to share objects between different sessions i would get a HttpSession and use the setAttribute method. Please how do i make my object available to the whole application
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60804
    
  65

Originally posted by Abiodun Adisa:
if i want to share objects between different sessions i would get a HttpSession and use the setAttribute method.
No. That would only make the object (termed a scoped variable) available to the same session.

Please how do i make my object available to the whole application
You can create the scoped variable in application context by calling setAttribute() on the servletContext.
[ December 01, 2007: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sharing Objects
 
Similar Threads
how many objects will be created.
Write to File
why we use object oriented programming
problem with wsdl2java in Axis
First class object -- what is it?