Home arrow SOAP & Web Services arrow Page 6 - Dynamic Data Analysis on the Web-a Design Approach

Presenting data - Web Services

Learn about an adaptable approach which separates programming tasks from Web page design tasks. This strong conceptual model encourages good design, enables re-use of data definitions, and is well-suited to the construction of dynamic user interfaces. The authors also illustrate the particular challenges you might encounter when you dynamically change the analysis performed by Web pages. (This intermediate-level article was first published by IBM developerWorks, August 5, 2004, at http://www.ibm.com/developerWorks).

TABLE OF CONTENTS:
  1. Dynamic Data Analysis on the Web-a Design Approach
  2. Data analysis concepts
  3. Dimensions and measures
  4. Filtering and ordering
  5. Dimension, measure, and slice dimension tags
  6. Presenting data
  7. Value formatting tags
  8. Use of JavaBeans to provide dynamic values
  9. Reporting common errors
  10. Tag containment
  11. Custom tags: lightweight, cheap, replaceable
  12. Benefits of this design approach
  13. In conclusion
By: developerWorks
Rating: starstarstarstarstar / 15
December 29, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

To present and explore the result data, the page author will require some further custom JSP tags. These custom tags will often be general purpose, and leave the page author in control of the layout and display attributes of the result values. In certain cases, specialised custom tags might provide a more sophisticated presentation of the entire result set.

Listing 2 shows some general purpose custom tags which can be used to iterate through the result values and extract individual values for presentation. In this case, the result values from the data definition shown in Listing 1 are formatted as a series of HTML tables, one for each year of sales results.

Listing 2. General purpose data presentation tags


<%@ taglib uri="/WEB-INF/tlds/dp.tld" prefix="dp" %>

<dp:forSlices id="slices" dataRef="sales">
  <TABLE border>
    <TBODY>
      <TR>
        <TH>Year</TH><TH>Product</TH><TH>Unit Sales</TH><TH>Revenue</TH>
      </TR>
      <dp:forRows id="rows" sliceRef="slices">
        <TR>
          <TD>
            <dp:write>
              <dp:valueFromColumn rowRef="rows">
                <dd:dimension>Year</dd:dimension>
              </dp:valueFromColumn>
            </dp:write>
          </TD>
          <TD>
            <dp:write>
              <dp:valueFromColumn rowRef="rows">
                <dd:dimension>Product</dd:dimension>
              </dp:valueFromColumn>
            </dp:write>
          </TD>
          <TD align="right">
            <dp:write>
              <dp:valueFromColumn rowRef="rows">
                <dd:measure>Unit Sales</dd:measure>
              </dp:valueFromColumn>
            </dp:write>
          </TD>
          <TD align="right">
            <dp:write>
              <dp:numberFormat style="currency" locale="server">
                <dp:valueFromColumn rowRef="rows">
                  <dd:measure>Revenue</dd:measure>
                </dp:valueFromColumn>
              </dp:numberFormat>
            </dp:write>
          </TD>
        </TR>
      </dp:forRows>
    </TBODY>
  </TABLE>
</dp:forSlices>

Slice and row iteration tags

In Listing 2, the taglib directive establishes the scope of the data presentation tags within the JSP with a prefix of dp.

The forSlices tag references a data tag by using the dataRef attribute to specify the id of the data tag. In this case, it references the data tag defined in Listing 1. The forSlices tag will evaluate its body for every slice in the result data. It, in turn, has an id attribute by which it might be referenced. In the example, an HTML table with borders switched on is defined for each slice. The page author, knowing the dimensions and measures to be presented, has included a row of suitable headers in each table. This is followed by a table row for each row of data within the slice.

The forRows tag references a forSlices tag using the sliceRef attribute. The forRows tag will evaluate its body for each row in the result data slice from the referenced forSlices tag. It, in turn, has an id attribute by which it might be referenced.



 
 
>>> More SOAP & Web Services Articles          >>> More By developerWorks
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

SOAP & WEB SERVICES ARTICLES

- Google Play Launched to Revive Brand
- Google Releases Preview of its Cloud SQL Ser...
- Microsoft and Amazon Team Up for the Cloud
- GoDaddy Joining the Cloud
- Amazon EBS Outage Challenges Cloud Supporters
- Dynamic Data Analysis on the Web-a Design Ap...
- Use collection types with SOAP and JAX-RPC
- Blogging Away To Glory (A bBlog Primer)
- Introduction to Service Oriented Architectur...
- Connecting Smart Devices on the Internet
- An Embeddable Standards Compliant Web Servic...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: