Using the Event CollectionEvent handling can also be defined using the <event-collection> element within <xframe>. This mechanism provides an easy way to organize event handlers by organizing them in one place. This feature is essential when you have a fairly complex page where different elements can respond from different events. The following is an example where three buttons are defined and event handlers for them are defined inside the event-collection element. <%@ taglib uri="http://www.jway.com/xui" prefix="xui"%>
In this example, we have three buttons that are defined and laid out using the grid layout manager. Each of these buttons are given a unique id using the ID attribute. This id is used as the reference point to attach an event to the object. As you can see inside the <event-collection> element, there are several <event> elements which are assigned with the object id as defined in the xbuttons. These IDs function as the link between the events and the objects. When one of the buttons is clicked, let's the BUTTON 1, then an JavaScript alert will be invoked and show "Button 1 Clicked!" as shown below:
| |
|
COPYRIGHT © 1997–2006
JWAY GROUP, Inc. |
|