Java
  Home arrow Java arrow Page 3 - Displaying Data from a Data-centric Web Pa...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Displaying Data from a Data-centric Web Page with Sun Java Creator 2
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2006-10-18

    Table of Contents:
  • Displaying Data from a Data-centric Web Page with Sun Java Creator 2
  • Referencing a Data Source
  • Connecting Table to Data
  • Displaying the Data

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Displaying Data from a Data-centric Web Page with Sun Java Creator 2 - Connecting Table to Data


    (Page 3 of 4 )

    From the 2k5Java data source you will be displaying the data from the table called Argentina as shown in the following window, which shows the Servers window in the Sun Java Creator 2 IDE.

    Now click on the table Argentina and click on the Table in the Design view of the web page. This changes the table column by bringing all the columns from the data source to the Table as shown. The rows in the design are just showing some data types, but not any from the data source.

    The act of dropping the table object from the data source onto the Table control on the web page has altered the outline of the page as shown. It is possible to click on the table element in the Outline and view the corresponding item on the Design view. You also see that a "SessionBean" has been automatically created and the argentinaDataProvider has been added to the page.

    Changes to page source code

    The page content changes as the Table is added, and it gets bound by your action of dropping the data source onto the table. Here is an extracted content for the table alone in the source view. In addition to the data binding of the table columns with rows of retrieved data from the data source, you also see considerable script support in the [CDATA[...]] section for data filtering and so forth.

     <ui:table augmentTitle="false" binding="#{Page1.table1}" 
    id="table1" style="height: 104px" title="Table" width="600">
    <script><![CDATA[
    /* ----- Functions for Table Preferences Panel ----- */
    /*
    * Toggle the table preferences panel open or closed
    */
    function togglePreferencesPanel() {
    var table = document.getElementById("form1:table1");
    table.toggleTblePreferencesPanel();
    }
    /* ----- Functions for Filter Panel ----- */
    /*
    * Return true if the filter menu has actually changed,
    * so the corresponding event should be allowed to continue.
    */
    function filterMenuChanged() {
    var table = document.getElementById("form1:table1");
    return table.filterMenuChanged();
    }
    /*
    * Toggle the custom filter panel (if any) open or closed.
    */
    function toggleFilterPanel() {
    var table = document.getElementById("form1:table1");
    return table.toggleTableFilterPanel();
    }
    /* ----- Functions for Table Actions ----- */
    /*
    * Initialize all rows of the table when the state
    * of selected rows changes.
    */
    function initAllRows() {
    var table = document.getElementById("form1:table1");
    table.initAllRows();
    }
    /*
    * Set the selected state for the given row groups
    * displayed in the table.  This functionality requires
    * the 'selectId' of the tableColumn to be set.
    *
    * @param rowGroupId HTML element id of the tableRowGroup component
    * @param selected Flag indicating whether components should be selected
    */
    function selectGroupRows(rowGroupId, selected) {
    var table = document.getElementById("form1:table1");
    table.selectGroupRows(rowGroupId, selected);
    }
    /*
    * Disable all table actions if no rows have been selected.
    */
    function disableActions() { // Determine whether any rows are currently 
    selected
    var table = document.getElementById("form1:table1"); var disabled = (table.getAllSelectedRowsCount() > 0) ? false : true;
    // Set disabled state for top actions document.getElementById("form1:
    table1:tableActionsTop:deleteTop").setDisabled(disabled); // Set disabled state for bottom actions document.getElementById("form1:
    table1:tableActionsBottom:deleteBottom").setDisabled(disabled); } </script> <ui:tableRowGroup binding="#{Page1.tableRowGroup1}" id="tableRowGroup1" rows="10" sourceData="#{Page1.argentinaDataProvider}" sourceVar="currentRow"> <ui:tableColumn binding="#{Page1.tableColumn1}" headerText="CustomerID" id="tableColumn1" sort="CustomerID"> <ui:staticText binding="#{Page1.staticText1}" id="staticText1" text="#{currentRow.value
    ['CustomerID']}"
    /> </ui:tableColumn> <ui:tableColumn binding="#{Page1.tableColumn2}" headerText="OrderDate" id="tableColumn2" sort="OrderDate"> <ui:staticText binding="#{Page1.staticText2}" id="staticText2" text="#{currentRow.value['OrderDate']}"/> </ui:tableColumn> <ui:tableColumn binding="#{Page1.tableColumn3}" headerText="RequiredDate" id="tableColumn3" sort="RequiredDate"> <ui:staticText binding="#{Page1.staticText3}" id="staticText3" text="#{currentRow.value['RequiredDate']}"/> </ui:tableColumn> <ui:tableColumn binding="#{Page1.tableColumn4}" headerText="ShipName" id="tableColumn4" sort="ShipName"> <ui:staticText binding="#{Page1.staticText4}" id="staticText4" text="#{currentRow.value['ShipName']}"/> </ui:tableColumn> <ui:tableColumn binding="#{Page1.tableColumn5}" headerText="KeyVal" id="tableColumn5" sort="KeyVal"> <ui:staticText binding="#{Page1.staticText5}" id="staticText5" text="#{currentRow.value['KeyVal']}"/> </ui:tableColumn> </ui:tableRowGroup> </ui:table>

    More Java Articles
    More By Jayaram Krishnaswamy


       · Microsoft dazzled developers with data centric web pages with no coding. But then...
     

    JAVA ARTICLES

    - Deploying Multiple Java Applets as One
    - Deploying Java Applets
    - Understanding Deployment Frameworks
    - Database Programming in Java Using JDBC
    - Extension Interfaces and SAX
    - Entities, Handlers and SAX
    - Advanced SAX
    - Conversions and Java Print Streams
    - Formatters and Java Print Streams
    - Java Print Streams
    - Wildcards, Arrays, and Generics in Java
    - Wildcards and Generic Methods in Java
    - Finishing the Project: Java Web Development ...
    - Generics and Limitations in Java
    - Getting Started with Java Web Development in...







    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 8 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek