index | next

Supporting Value Change Listeners

If your custom component subclasses UIInput, you can fire value change events to interested listeners.

Here is an application where spinner buttons fire change events that are counted and displayed: spinner2.

The listener is attached to the spinner tags with the valueChangeListener attribute just as they are attached to standard tags (see ch. 7): index.jsp.

The listener simply keeps a count of the number of times it is notified:
public class CreditCardExpiration {
    private int changes = 0;
    // to demonstrate the value change listener
    public void changeListener(ValueChangeEvent e) {
	changes++;
    }
}

index | next