File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes ImageObserver in servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "ImageObserver in servlets" Watch "ImageObserver in servlets" New topic

ImageObserver in servlets

Bob Moranski
Ranch Hand

Joined: Nov 22, 2000
Posts: 177
Hi, I have a question on ImageObserver in servlets. Why is it sometimes we need to create the ImageObserver on the class level and other times as a local variable of doGet()? What is the difference?
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
The obvious difference is that a local variable should only exist for the duration of the request-response cycle, whereas an instance variable will hang around for the life of the servlet object.
I'm really curious as to what you are doing that needs an ImageObserver at all? When I need to load an Image into a servlet I use a MediaTracker.
Bob Moranski
Ranch Hand

Joined: Nov 22, 2000
Posts: 177
Hi, don't you have to have an ImageObserver as the parameter to a MediaTracker object?
MediaTracker mt = new MediaTracker(frame); ? frame is an ImageObserver?
I agree. Here's the link:
subject: ImageObserver in servlets
It's not a secret anymore!