Jakarta Project: Data Grid Tag library

Version: 1.0

Table of Contents

Overview

JSP TagLib that generates HTML DataGrids.

This JSP tag library can be used to create web tables with data, calculate aggregations, order the table values, do paging.

Requirements

This custom tag library requires a servlet container that supports the JavaServer Pages Specification, version 1.2 or higher. It also requires the Jakarta JSTL Tag Libraries 1.0 and the Common Math Library 1.0.

Configuration

Follow these steps to configure your web application with this tag library:

To use the tags from this library in your JSP pages, add the following directive at the top of each page:

<%@ taglib uri="http://jakarta.apache.org/taglibs/datagrid-1.0" prefix="ui" %>

where "ui" is the tag name prefix you wish to use for tags from this library. You can change this value to any prefix you like.

Tag Summary

DataGrid Tag
dataGridThe DataGrid tag create web tables with data that can be ordered, paged and apply aggregate functions.
 

Tag Reference

dataGrid Availability: 1.0

Tag to create datagrids

Tag Bodytagdependent    
Restrictions

None

AttributesNameRequired Runtime Expression Evaluation Availability
 items  Yes   No  1.0
 

Attribute to set the collection that stores the values that will be used to render the datagrid.

 scroll  No   Yes  
 

Attribute to set a vertical scroll bar. If the value is true a vertical scroll bar will be rendered with the datagrid.

 rules  No   Yes  
 

Attribute to set the rules attribute of the datagrid table.

 frame  No   Yes  
 

Attribute to set the frame attribute of the datagrid table.

 style  No   Yes  
 

Attribute to set the CSS style for the datagrid.

 styleClass  No   Yes  
 

Attribute to set the CSS class for the datagrid.

 var  Yes   No  
 

Attribute to set the name of the JSTL variable used to access each the collection value.

 height  No   Yes  
 

Attribute to set the height of the datagrid in pixels or percentages. This value will apply if scrolling is enabled.

 width  No   Yes  
 

Attribute to set the width of the datagrid in pixels or percentages. If a percentage is used then scrolling is disabled.

 cellPadding  No   Yes  
 

Attribute to set the cell padding of the datagrid.

 cellSpacing  No   Yes  
 

Attribute to set the cell spacing of the datagrid.

 name  Yes   Yes  
 

Attribute to set the name of the datagrid.

 requestPath  No   Yes  
 

Attribute to set the request path used to construct the URL for ordering and paging functionality in the datagrid.

VariablesNone
Examples Example of datagrid tag library.  
  <% request.setAttribute ("employees", employees); %>


            
            <ui:dataGrid items="${employees}" var="employee" name="datagrid1" cellPadding="0" cellSpacing="0">
              <columns>
                <column width="100" order="true">
                  <header value="Name" hAlign="center"/>
                  <item   value="${employee.firstName} ${employee.lastName}" hAlign="left"/>
                  <aggregate function="count" var="total"/>
                  <footer value="Total ${total}" hAlign="left"/>      
                </column>
                <column width="200" order="true">
                  <header value="Salary" hAlign="center"/>
                  <item   value="${employee.salary}" hAlign="right" pattern="#,##0.00"/>
                  <aggregate function="avg" pattern="#,##0.00" var="total"/>
                  <footer value="Average ${total}" hAlign="right"/>
                </column>
                <column width="200" order="true">
                  <header value="Bonus" hAlign="center"/>
                  <item   value="${employee.bonus}" hAlign="right" pattern="#,##0.00"/>
                  <aggregate function="avg" pattern="#,##0.00" var="total"/>
                  <footer value="Average ${total}" hAlign="right"/>
                </column>
              </columns>
              <header        styleClass="header" show="true"/>
              <footer        styleClass="footer" show="true"/>
              <rows          styleClass="rows" hiliteStyleClass="hiliterows"/>
              <alternateRows styleClass="alternaterows"/>
            </ui:dataGrid>
             
          

Examples

See the example application datagrid-examples.war for examples of the usage of the tags from this custom tag library.

Java Docs

Java programmers can view the java class documentation for this tag library as javadocs.

Revision History

Review the complete revision history of this tag library.