jQuery in Action, 3rd edition
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

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
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: 13018
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: http://aspose.com/file-tools
subject: ImageObserver in servlets
jQuery in Action, 3rd edition