XML Server Getting Started    
Extending Existing Elements (Multiple Inheritance) 
As it is mentioned in the previous section, Internet Explorer 5.0 introduced an ability to add properties, methods, and events 
to existing HTML and XML tags.  The power of this mechanism for application programming can not be overestimated. In 
this section we will illustrate how application developers can extend the functionality of, perhaps, the most important element 
in XMLSP suite   XMLControl. 
In the beginning of this tutorial we create simple XML Server Page with the customer list, which displays customers from 
different states of Unites States and Canada (
/Examples/Tutorial/step1.jsp
). Now, let's say we would like to improve the 
functionality of the page to add the ability to highlight (select) all customers from a particular state.  
We will introduce an  control to let user enter the state code (NY, NJ, CO etc.) and the button to invoke the action: 
 
 
 
  Type state code and click "Select" button: 
   
   
  
  
inset;"/> 
 
 
 
If we were to place the code do select state customers directly in the  onclick  event handler we would have written the 
following: 
  function btn_select::onclick() { 
    customers.selectRow(0, false); 
    var stateCustomers = customers.findRows( 
         "//x:band[@name= Detail ]/x:col[@name= state  and text()= " + state + " ]/parent::*" 
    );     
    for (var i=0; i
       customers.selectRow(stateCustomers[i], true); 
    } 
    if (stateCustomers.length > 0) customers.scrollToRow(stateCustomers[0]); 
  } 
The first line in the above event handler  unselects  all rows in the XMLControl  customers . The next one fills in array of 
row numbers matching the XPath expression 
 2000 2002 Computer Technology Inc. All rights reserved. 
Page 21 




J2EE Web Hosting Tundra XML Server Pages J2EE Hosting




 
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved.