Developing Java Beans changed, the getPropertyName() method may
Developing Java Beans { // the current temperature in Celsiusprotected double currentTemp = 22.2; // the collection of objects listening for property changes protected Vector propChangeListeners = new Vector(); // the constructors public Temperature(double startingTemp) { this(); currentTemp = startingTemp; } public Temperature() { } // the get method for property CurrentTemperature public double getCurrentTemperature() { return currentTemp; } // add a property change listener public synchronized void addPropertyChangeListener(PropertyChangeListener l) { // add a listener if it is not already registered if (!propChangeListeners.contains(l)) { propChangeListeners.addElement(l); } } // remove a property change listener public synchronized void removePropertyChangeListener(PropertyChangeListener l) { // remove it if it is registered if (propChangeListeners.contains(l)) { propChangeListeners.removeElement(l); } } // notify listening objects of CurrentTemperature property changesprotected void notifyTemperatureChange() { // create the event objectPropertyChangeEvent evt = new PropertyChangeEvent(this, “CurrentTemperature”, null, new Double(currentTemp)); // make a copy of the listener object vector so that it cannot// be changed while we are firing eventsVector v; synchronized(this) { v = (Vector) propChangeListeners.clone(); } // fire the event to all listenersint cnt = v.size(); page 57
Note: If you are looking for inexpensive but high quality provider to host and run your jsp application check Astra jsp hosting services