Update of /cvsroot/displaytag/display09/examples/web/jsp
In directory sc8-pr-cvs1:/tmp/cvs-serv22073/examples/web/jsp

Added Files:
        TotalWrapper.java.txt Wrapper.java.txt example-autolink.jsp 
        example-callbacks.jsp example-columns.jsp example-config.jsp 
        example-datasource.jsp example-decorator-link.jsp 
        example-decorator.jsp example-details.jsp example-export.jsp 
        example-grouping.jsp example-imp-objects.jsp example-misc.jsp 
        example-nocolumns.jsp example-paging.jsp example-pse.jsp 
        example-sorting.jsp example-styles.jsp example-subsets.jsp 
        index.jsp 
Log Message:


--- NEW FILE: TotalWrapper.java.txt ---
/**
 * $Id: TotalWrapper.java.txt,v 1.1 2003/06/12 22:46:10 fgiust Exp $
 *
 * Status: Ok
 **/

package org.apache.taglibs.display.test;

import org.apache.taglibs.display.TableDecorator;

/**
 * This decorator only does a summing of different groups in the reporting
 * style examples...
 **/

public class TotalWrapper extends TableDecorator
{
   private double cityTotal = 0;
   private double grandTotal = 0;

   /**
    * After every row completes we evaluate to see if we should be drawing a
    * new total line and summing the results from the previous group.
    */

   public String finishRow()
   {
      int listindex = this.getList().indexOf( this.getObject() );
      ReportableListObject o1 = (ReportableListObject)this.getObject();
      String nextCity = "";

      cityTotal += o1.getAmount();
      grandTotal += o1.getAmount();

      if( listindex == this.getList().size() - 1 ) {
         nextCity = "XXXXXX"; // Last row hack, it's only a demo folks...
      } else {
         nextCity = ( (ReportableListObject)this.getList().get( listindex + 1 ) 
).getCity();
      }

      StringBuffer sb = new StringBuffer( 1000 );

      // City subtotals...
      if( !nextCity.equals( o1.getCity() ) ) {
         sb.append( "<tr><td>&nbsp;</td><td>&nbsp;</td><td><hr noshade 
size=\"1\"></td>" );
         sb.append( "<td>&nbsp;</td></tr>" );

         sb.append( "<tr><td>&nbsp;</td>" );
         sb.append( "<td align=\"right\"><b>" + o1.getCity() + " 
Total:</b></td><td><b>" );
         sb.append( cityTotal );
         sb.append( "</b></td><td>&nbsp;</td></tr>" );
         sb.append( "<tr><td colspan=\"4\">&nbsp;</td></tr>" );

         cityTotal = 0;
      }

      // Grand totals...
      if( listindex == this.getList().size() - 1 ) {
         sb.append( "<tr><td colspan=\"4\"><hr noshade size=\"1\"></td></tr>" );
         sb.append( "<tr><td>&nbsp;</td>" );
         sb.append( "<td align=\"right\"><b>Grand Total:</b></td><td><b>" );
         sb.append( grandTotal );
         sb.append( "</b></td><td>&nbsp;</td></tr>" );
      }

      return sb.toString();
   }
}

--- NEW FILE: Wrapper.java.txt ---
/**
 * $Id: Wrapper.java.txt,v 1.1 2003/06/12 22:46:10 fgiust Exp $
 *
 * Status: Ok
 **/

package org.apache.taglibs.display.test;

import java.text.DecimalFormat;
import java.text.SimpleDateFormat;

import org.apache.taglibs.display.TableDecorator;

/**
 * This class is a decorator of the TestObjects that we keep in our List.  This
 * class provides a number of methods for formatting data, creating dynamic
 * links, and exercising some aspects of the display:table API functionality
 **/

public class Wrapper extends TableDecorator
{
   private SimpleDateFormat datefmt = null;
   private DecimalFormat moneyfmt = null;

   /**
    * Creates a new Wrapper decorator who's job is to reformat some of the
    * data located in our TestObject's.
    */

   public Wrapper()
   {
      super();

      // Formats for displaying dates and money.

      this.datefmt = new SimpleDateFormat( "MM/dd/yy" );
      this.moneyfmt = new DecimalFormat( "$ #,###,###.00" );
   }


   /**
    * Returns the date as a String in MM/dd/yy format
    */

   public String getDate()
   {
      return this.datefmt.format( ( (ListObject)this.getObject() ).getDate() );
   }

   /**
    * Returns the money as a String in $ #,###,###.00 format
    */

   public String getMoney()
   {
      return this.moneyfmt.format( ( (ListObject)this.getObject() ).getMoney() );
   }

   /**
    * Returns the TestObject's ID as a hyperlink that the person can click on
    * and "drill down" for more details.
    */

   public String getLink1()
   {
      ListObject obj = (ListObject)this.getObject();
      int index = this.getListIndex();

      return "<a href=\"details.jsp?index=" + index + "\">" + obj.getId() + "</a>";
   }

   /**
    * Returns an "action bar" of sorts that allow the user to perform various
    * actions on the TestObject based on it's id.
    */

   public String getLink2()
   {
      ListObject obj = (ListObject)this.getObject();
      int id = obj.getId();

      return "<a href=\"details.jsp?id=" + id + "&action=view\">View</a> | " +
         "<a href=\"details.jsp?id=" + id + "&action=edit\">Edit</a> | " +
         "<a href=\"details.jsp?id=" + id + "&action=delete\">Delete</a>";
   }
}
--- NEW FILE: example-autolink.jsp ---
<%@ include file="inc/header.jsp" %>

<% request.setAttribute( "test", new TestList( 10 ) ); %>

<h2><a href="./index.jsp">Examples</a> > Standard, smart linking of column data</h2>

<ul id="showsource">
        <li><a href="./example-autolink.html">View JSP Source</a></li>
</ul>


<display:table name="test" >
  <display:column property="id" title="ID" />
  <display:column property="email" autolink="true" />
  <display:column property="url" autolink="true" />
</display:table>

<p>
        If you have email addresses or web URLs in the data that you are displaying in
        columns of your table, then you can set the <code>autolink="true"</code>
        attribute in your display:column tag, and that will tell the display:table to
        automatically display those pieces of data as hyperlinks, you will not have
        to take any action to convert that data.
<p>

<ul>
        <li>
                Email addresses will be wrapped with a <code>&lt;a 
href="mailto:xxx"&gt;xxx&lt;/a&gt;</code> tag,
                where "xxx" is the email address that was detected.
        </li>
        <li>    
                Web URLs will be wrapped with a <code>&lt;a 
href="xxx"&gt;xxx&lt;/a&gt;</code> tag,
                where "xxx" is the URL that was detected (it can be any valid URL 
type, http://, https://, ftp://, etc...)
        </li>
</ul>

<p>
        If your column data has additional text, only the data that appears to be an
        email address or a URL will be linked (not the entire column).
</p>

<p>
        Turning on autolink does carry a performance penalty, as each string has to be
        scanned for patterns and updated if it matches on an address or URL.
</p>


<%@ include file="inc/footer.jsp" %>

--- NEW FILE: example-callbacks.jsp ---
<%@ include file="inc/header.jsp" %>

<% request.setAttribute( "test", new ReportList( 10 ) ); %>

<h2><a href="./index.jsp">Examples</a> > Using callbacks to show totals</h2>

<ul id="showsource">
        <li><a href="./example-callbacks.html">View JSP Source</a></li>
</ul>


<display:table name="test" decorator="org.apache.taglibs.display.test.TotalWrapper" >
  <display:column property="city" title="CITY" group="1" />
  <display:column property="project" title="PROJECT" group="2" />
  <display:column property="amount" title="HOURS" />
  <display:column property="task" title="TASK" />
</display:table>


<p>
        The decorator API provides more then just the ability to reformat data before
        it is put into columns, it also provides a hook that allows you perform some
        action on the table after each row is processed.  This allows you to interject
        some code that allows you to figure out where you are in the list of data, and
        then insert an additional row with totals, etc...  Typically you would use this
        functionality along with <a href="./example-grouping.jsp">grouping</a> 
features to spit out some
        nice web based reports.
</p>

<p>
        See the TableDecorator.finishRow() API documentation, along with the example
        decorator that is used in this example page.  The source for the decorator for
        this page is <a href="./TotalWrapper.java.txt">here</a>.
</p>


<%@ include file="inc/footer.jsp" %>
--- NEW FILE: example-columns.jsp ---
<%@ include file="inc/header.jsp" %>

<% request.setAttribute( "test", new TestList( 10 ) ); %>


<h2><a href="./index.jsp">Examples</a> > Basic, columns</h2>

<ul id="showsource">
        <li><a href="./example-columns.html">View JSP Source</a></li>
</ul>

<display:table name="test" >
  <display:column property="id" title="ID" />
  <display:column property="name" />
  <display:column property="email" />
  <display:column property="status" />
  <display:column property="description" title="Comments"/>
</display:table>


<p>
        This starts to show you how to use the table tag, you point the table tag at
        a datasource (a List), and then define a number of columns that map to
        property methods (getXXX) for each object in the List.
</p>

<p>
        Note that you have one column tag for every column that you want to appear in
        the table, and the column specifies what property is shown in that particular
        row.
</p>

<p>
        The column property specifies what <code>getXXX</code> method is called on 
each item
        in the list.  So for the second column, <code>getName</code> is called, and by
        default the property name is used as the header of the column (unless you give
        it an explicit column name).
</p>


<%@ include file="inc/footer.jsp" %>
--- NEW FILE: example-config.jsp ---
<%@ include file="inc/header.jsp" %>


<% request.setAttribute( "test", new TestList( 10 ) ); %>
<% request.setAttribute( "test2", new ArrayList() ); %>
<% Object foo = session.getAttribute( "test3" );
   if( foo == null ) {
      session.setAttribute( "test3", new TestList( 320 ) );
   }
%>

<h2><a href="./index.jsp">Examples</a> > Config, Overriding defaults</h2>

<ul id="showsource">
        <li><a href="./example-config.html">View JSP Source</a></li>
</ul>


<p>
        There are a number of "default" values and strings used by the display tags to
        show messages, decide which options to display, etc...  You can use the
        &lt;display:setProperty name=... value=...&gt; tag to override these default
        values.  This is useful if you want to change the behavior of the tag a little
        (for example, don't show the header, or only show 1 export option), or if you
        need to localize some of the default messages and banners.
</p>


<display:table name="sessionScope.test3" export="true" pagesize="10" 
decorator="org.apache.taglibs.display.test.Wrapper" >
  <display:column property="id" title="ID" />
  <display:column property="name" />
  <display:column property="email" />
  <display:column property="nullValue" nulls="true"/>
  <display:column property="date" align="right" />

  <display:setProperty name="export.amount" value="list" />
  <%-- <display:setProperty name="export.decorated" value="false" /> --%>

  <display:setProperty name="export.xml" value="false" />
  <display:setProperty name="export.excel.include_header" value="true" />

  <display:setProperty name="paging.banner.group_size" value="6" />
  <display:setProperty name="paging.banner.prev_label" value="Back" />
  <display:setProperty name="paging.banner.next_label" value="Forw" />
  <display:setProperty name="paging.banner.item_name" value="Cat" />
  <display:setProperty name="paging.banner.items_name" value="Cats" />
  <display:setProperty name="paging.banner.some_items_found" value="{0} {1} sleeping, 
waking {2} to {3}" />

</display:table>


<p>
        The various properties that are currently available are listed along with
        their default values and a brief explanation.
</p>

<table>
        <thead>
                <tr>
                        <th>Property</th>
                        <th>Default</th>
                        <th>Valid Values</th>
                        <th>Description</th>
                </tr>
        </thead>
        <tbody>

                <tr>
                        <td>basic.show.header</td>
                        <td>true</td>
                        <td>true, false </td>
                        <td>
                                Indicates if you want the header to appear at the top 
of the
                                table, the header contains the column names, and any 
additional action banners
                                that might be required (like paging, export, etc...)
                        </td>
                </tr>
                
                <tr>
                        <td>basic.msg.empty_list</td>
                        <td>Nothing found to display</td>
                        <td>Any string</td>
                        <td>
                                The message that is displayed with the list that this 
table is
                                associated with is either null, or empty
                        </td>
                </tr>
                
                <tr>
                        <td>sort.behavior</td>
                        <td>page</td>
                        <td>page, list</td>
                        <td>
                                Describes the behavior that happens when a user clicks 
on
                                a sortable column in a table that is showing just a 
portion of a long list.  The
                                default behavior (page), just resorts the elements 
currently being displayed
                                and leaves the user showing the same subset.  If you 
change this value to (list)
                                then the entire list will be resorted, and the user 
will be taken back to
                                the first subset of the newly sorted list.
                        </td>
                </tr>
                
                <tr>
                        <td>export.banner</td>
                        <td>Export options: {0}</td>
                        <td>Any string in a message format with 1 placeholder</td>
                        <td>
                                Contains the string that is displayed in the table 
footer when
                                the user indicates that they want to enabled the 
export function.  The placeholder
                                is replaced with links to the various export formats 
that are support.
                        </td>
                </tr>
                
                <tr>
                        <td>export.sepchar</td>
                        <td> | </td>
                        <td>Any string</td>
                        <td>
                                Used to seperate the valid export type (typically 
would be a
                                bar a comma, or a dash).
                        </td>
                </tr>
                
                <tr>
                        <td>export.csv</td>
                        <td>true</td>
                        <td>true, false</td>
                        <td>
                                Should the tag present the option to export data in 
comma
                                seperated format (csv).
                        </td>
                </tr>
                
                <tr>
                        <td>export.csv.label</td>
                        <td>CSV</td>
                        <td>Any string</td>
                        <td>
                                The label on the link that the user clicks on to 
export the data in CSV format.
                        </td>
                </tr>
                
                <tr>
                        <td>export.csv.mimetype</td>
                        <td>text/csv</td>
                        <td>Any valid mime-type</td>
                        <td>
                                The MIME type that is used when sending CSV data back 
to the
                                user's web browser.  I can't think of many reasons you 
would want to change
                                this, but perhaps you want to launch a specific 
program to deal with the data
                                on the user's system.
                        </td>
                </tr>
                
                <tr>
                        <td>export.csv.include_header</td>
                        <td>false</td>
                        <td>true, false</td>
                        <td>
                                If set to true, then the first line of the export will
                                contain the column titles as displayed on the HTML 
page.  By default this is
                                set to false, so the header is not included in the 
export.
                        </td>
                </tr>
                
                
                <tr>
                        <td>export.excel</td>
                        <td>true</td>
                        <td>true, false</td>
                        <td>Should the tag present the option to export data in Excel
                        format (tab seperated values)
                        </td>
                </tr>
                
                <tr>
                        <td>export.excel.label</td>
                        <td>Excel</td>
                        <td>Any string</td>
                        <td>The label on the link that the user clicks on to export the
                        data in Excel format
                        </td>
                </tr>
                
                <tr>
                        <td>export.excel.mimetype</td>
                        <td>application/vnd.ms-excel</td>
                        <td>Any valid mime-type</td>
                        <td>The MIME type that is used when sending Excel data back to 
the
                        user's web browser.  I can't think of many reasons you would 
want to change
                        this, but perhaps you want to launch a specific program to 
deal with the data
                        on the user's system
                        </td>
                </tr>
                
                <tr>
                        <td>export.excel.include_header</td>
                        <td>false</td>
                        <td>true, false</td>
                        <td>If set to true, then the first line of the export will
                        contain the column titles as displayed on the HTML page.  By 
default this is
                        set to false, so the header is not included in the export.
                        </td>
                </tr>
                
                <tr>
                        <td>export.xml</td>
                        <td>true</td>
                        <td>true, false</td>
                        <td>Should the tag present the option to export data in XML
                        format
                        </td>
                </tr>
                
                <tr>
                        <td>export.xml.label</td>
                        <td>XML</td>
                        <td>Any string</td>
                        <td>The label on the link that the user clicks on to export the
                        data in XML format</td>
                </tr>
                
                <tr>
                        <td>export.xml.mimetype</td>
                        <td>text/xml</td>
                        <td>Any valid mime-type</td>
                        <td>The MIME type that is used when sending XML data back to 
the
                        user's web browser.  I can't think of many reasons you would 
want to change
                        this, but perhaps you want to launch a specific program to 
deal with the data
                        on the user's system</td>
                </tr>
                
                <tr>
                        <td>export.amount</td>
                        <td>list</td>
                        <td>page, list</td>
                        <td>Indicates how much data should be sent down to the user 
when
                        they ask for a data export.  By default, it sends the entire 
list, but you can
                        instruct the table tag to only send down the data that is 
currently being
                        shown on the page</td>
                </tr>
                
                <tr>
                        <td>export.decorated</td>
                        <td>true</td>
                        <td>true, false</td>
                        <td>Should the data be "decorated" as it is exported.  The 
default
                        value is true, but you might want to turn off any decoratation 
that is HTML
                        specific for example when exporting the data.</td>
                </tr>
                
                
                <tr>
                        <td>paging.banner.placement</td>
                        <td>top</td>
                        <td>top, bottom, both</td>
                        <td>When the table tag has to show the header for paging 
through a long list, this
                        option indicates where that header should be shown in relation 
to the table
                        </td>
                </tr>
                
                
                <tr>
                        <td>paging.banner.item_name</td>
                        <td>item</td>
                        <td>Any string</td>
                        <td>What the various objects in the list being displayed should
                        be refered to as (singular)</td>
                </tr>
                
                
                <tr>
                        <td>paging.banner.items_name</td>
                        <td>items</td>
                        <td>Any string</td>
                        <td>What the various objects in the list being displayed should
                        be refered to as (plural)</td>
                </tr>
                
                <tr>
                        <td>paging.banner.no_items_found</td>
                        <td>No {0} found.</td>
                        <td>Any string in a message format with 1 placeholder</td>
                        <td>What is shown in the pagination header when no objects are
                        available in the list to be displayed.  The single placeholder 
is replaced
                        with the name of the items in the list (plural)
                        </td>
                </tr>
                
                <tr>
                        <td>paging.banner.one_items_found</td>
                        <td>1 {0} found.</td>
                        <td>Any string in a message format with 1 placeholder</td>
                        <td>What is shown in the pagination header when one object is
                        available in the list to be displayed.  The single placeholder 
is replaced
                        with the name of the items in the list (singular)
                        </td>
                </tr>
                
                <tr>
                        <td>paging.banner.all_items_found</td>
                        <td>{0} {1} found, showing all {2}</td>
                        <td>Any string in a message format with 3 placeholders</td>
                        <td>What is shown in the pagination header when all the objects
                        in the list are being shown. {0} and {2} are replaced with the 
number of objects
                        in the list, {1} is replaced with the name of the items 
{plural}
                        </td>
                </tr>
                
                <tr>
                        <td>paging.banner.some_items_found</td>
                        <td>{0} {1} found, displaying {2} to {3}</td>
                        <td>Any string in a message format with 4 placeholders</td>
                        <td>What is shown in the pagination header when a partial list
                        of the the objects in the list are being shown. {0} indicates 
the total number
                        of objects in the list, {1} is replaced with the name of the 
items (plural},
                        {2} and {3} are replaced with the start and end index of the 
objects being shown
                        respectively
                        </td>
                </tr>
                
                <tr>
                        <td>paging.banner.include_first_last</td>
                        <td>false</td>
                        <td>true, false</td>
                        <td>Should the banner contain a "First" and "Last" link to 
instantly
                        jump to the start and end of the list.  The default behavior 
is to not include
                        those links
                        </td>
                </tr>
                
                <tr>
                        <td>paging.banner.first_label</td>
                        <td>First</td>
                        <td>Any string</td>
                        <td>Label for the link that takes the person to the first page
                        of objects being shown in the list
                        </td>
                </tr>
                
                <tr>
                        <td>paging.banner.last_label</td>
                        <td>Last</td>
                        <td>Any string</td>
                        <td>Label for the link that takes the person to the last page
                        of objects being shown in the list
                        </td>
                </tr>
                
                <tr>
                        <td>paging.banner.prev_label</td>
                        <td>Prev</td>
                        <td>Any string</td>
                        <td>Label for the link that takes the person to the previous 
page
                        of objects being shown in the list
                        </td>
                </tr>
                
                <tr>
                        <td>paging.banner.next_label</td>
                        <td>Next</td>
                        <td>Any string</td>
                        <td>Label for the link that takes the person to the next page
                        of objects being shown in the list
                        </td>
                </tr>
                
                <tr>
                        <td>paging.banner.group_size</td>
                        <td>8</td>
                        <td>Any reasonable number</td>
                        <td>
                                The number of pages to show in the header that this 
person can instantly jump to
                        </td>
                </tr>
        </tbody>
</table>


<%@ include file="inc/footer.jsp" %>
--- NEW FILE: example-datasource.jsp ---
<%@ include file="inc/header.jsp" %>

<% request.setAttribute( "test", new TestList( 10 ) ); %>

<h2><a href="./index.jsp">Examples</a> > Basic, acquiring your List of data</h2>

<ul id="showsource">
        <li><a href="./example-datasource.html">View JSP Source</a></li>
</ul>


<p>
        Up until this point, we have simply had a List object available to us under the
        name "list" in the request scope that has driven the display of the tables
        shown.  We have been setting up that bean with the following scriptlet, but
        presumably you would be doing something similar in your Action class rather
        then raw on this jsp page.
</p>

<pre>
&lt;% request.setAttribute( "test", new TestList( 10 ) ); %&gt;
</pre>

<p>
        This table is called with the following attributes:
</p>

<pre>
&lt;display:table name="test"&gt;
</pre>

<display:table name="test" >
  <display:column property="id" title="ID" />
  <display:column property="name" />
  <display:column property="email" />
  <display:column property="status" />
  <display:column property="description" title="Comments"/>
</display:table>


<p>
        But, like other struts tags, you can acquire a handle to the list you
        want to display by specifying not only a bean name, but also a bean property
        (a getter method), and the table tag will call that property to fetch the list
        to display.
</p>

<div class="changed">
        <p>
                The value of the <code>name</code> attribute can be expressed with a 
sintax similar to 
                <acronym title="expression language">EL</acronym> of <acronym 
title="Java standart ag library">JSTL</acronym>.
        </p>
        
        <p>
                You can define the scope of the bean adding one of the following 
suffix:
        </p>
        <ul>
                <li>pageScope</li>
                <li>requestScope (default)</li>
                <li>sessionScope</li>
                <li>applicationScope</li>
        </ul>
        
        <p>
                You can also access javabean style properties, mapped properties or 
indexed properties in the bean, also nested!.
                The sintax for accessing a javabean property is 
<code>.property</code>. You can read a mapped property specifing it
                between <code>()</code> and an indexed property using <code>[]</code>.
        </p>
        
        <p>
                So the following:
        </p>
        
        <code>sessionScope.list.value.attribute(name).item[1]</code>
        
        <p>
        is equivalent to:
        </p>
        
        
<code>session.getAttribute("list").getValue().getAttribute("name").getItem[1]</code>
        
        
        <p>
                Note: Why not using really LE? Two main reasons:
        </p>
        <ul>
                <li>compatibility with &lt; 0.9 version of the display tag library</li>
                <li>compatibility with J2EE 1.2 (JSTL and LE require j2ee 1.3)</li>
        </ul>
</div>

<p>
        The lists above and below are both generated randomly each time you come to
        this page, but since this list of data is attached to your session, it should
        remain the same through page refreshes.
</p>

<p>
        This table is called with the following attributes:
</p>


<pre>
&lt;display:table name="sessionScope.holder.list"&gt;
</pre>

<% 
        Object foo = session.getAttribute( "holder" );
        if( foo == null ) {
      ListHolder h = new ListHolder();
      session.setAttribute( "holder", h );
        }
%>


<display:table name="sessionScope.holder.list" >
  <display:column property="id" title="ID" />
  <display:column property="name" />
  <display:column property="email" />
  <display:column property="status" />
  <display:column property="description" title="Comments"/>
</display:table>


<p class="changed">
        For compatibility with previous versions of the display tag library you can 
use the separated
        <code>scope</code> and <code>property</code> attributes. This is now 
deprecated, since now
        the code is optimized using the new expression language. Anyway, this will 
still work:
</p>

<code>
@deprecated!
&lt;display:table name="holder" property="list" scope="session"&gt;
</code>







<p>
        If you are doing sick stuff in your JSP pages, you can also pass in the list
        of objects directly into the tag.  Although I would hope this approach is not
        used very often... The table below is generated from the following scriptlet
        code and attributes: (Note it only has 5 rows)
</p>

<pre>
&lt;% List blech = new TestList( 5 ); %&gt;
&lt;display:table list="&lt;%= blech %&gt;" &gt;
</pre>

<% List blech = new TestList( 5 ); %>

<display:table list="<%= blech %>" >
  <display:column property="id" title="ID" />
  <display:column property="name" />
  <display:column property="email" />
  <display:column property="status" />
  <display:column property="description" title="Comments"/>
</display:table>

<p>
        By default, if you supply the table tag with either a null object, or an
        empty list, then it will display the column headers like it normally would, but
        will then display a single row that spans all the columns that says
        "Nothing found to display".
</p>

<p class="changed">
        You can override this message using a &lt;setProperty&gt; tag or a custom 
properties file.
        See <a href="example-config.jsp">Config, overriding default 
behaviors/messages</a> page.
</p>

<% request.setAttribute( "test2", null ); %>

<display:table name="test2" >
  <display:column property="id" title="ID" />
  <display:column property="name" />
  <display:column property="email" />
  <display:column property="status" />
  <display:column property="description" title="Comments"/>
</display:table>



<%@ include file="inc/footer.jsp" %>
--- NEW FILE: example-decorator-link.jsp ---
<%@ include file="inc/header.jsp" %>

<% Object foo = session.getAttribute( "details" );
   if( foo == null ) {
      session.setAttribute( "details", new TestList( 10 ) );
   }
%>

<h2><a href="./index.jsp">Examples</a> > Standard, creating dynamic links</h2>

<ul id="showsource">
        <li><a href="./example-decorator-link.html">View JSP Source</a></li>
</ul>

<p>
        There are two ways to create dynamic links that should appear in a column.  The
        first method is a "struts-like" approach which works well if the link you want
        to create is based on just a single property of the object being displayed 
(like
        a primary key value).  The second approach makes use of decorators as described
        on the previous example.  A decorator should be used when the dynamic link 
being
        created relies on multiple pieces of information, relies on the index of the
        object in the list, relies on some other data around it, or you want to change
        the text that is linked (ie you want it to say "edit", instead of showing the
        primary key of the object).  Below I show how to use both examples.
</p>

<h3>Stuts-like approach</h3>

<p>
        The column tag provides 5 struts-like attributes that can be set to create a
        dynamic linke ( href, paramID, paramName, paramProperty, paramScope ).  See the
        display:column documentation, and the struts documentation for a complete 
description
        of their usage, but basically:
</p>

<dl>

        <dt>href</dt>
        <dd>the base URL used to construct the dynamic link</dd>

        <dt>paramId</dt>
        <dd>the name of the parameter that gets added to the URL specified above</dd>
        
        <dt>paramName</dt>
        <dd>name of the bean that contains the data we want to tack on the the URL 
(typicall null, indicating the current object in the List)</dd>
        
        <dt>paramProperty</dt>
        <dd>property to call on the object specified above to return the value that 
gets tacked onto the URL.</dd>
        
        <dt>paramScope</dt>
        <dd>specific scope where the databean lives, typically null</dd>
</dl>

<p>
        Of these params, you typically would not use paramName and paramScope.  Leaving
        each as null indicates that you want to use the object corresponding to the
        current row being processed.
</p>


<display:table name="sessionScope.details">
  <display:column property="id" title="ID" href="details.jsp" paramId="id" 
paramProperty="id" />
  <display:column property="email" />
  <display:column property="status" />
</display:table>


<h3>Using a decorator</h3>

<p>
        The previous example page introduced the decorator to format dates, money, 
etc...  It
        can also be used to create dynamic links on the fly so that you can either
        click on a particular column value and "drill down" for more information, or
        you can create a column of text labels which are hyperlinks that perform some
        action on the object in that row.
</p>

<p>
        These dynamic links can be created based on some primary key of the object, or
        they can make use of the object List index.
</p>

<p>
        Below is a table that has two columns that have hyperlinks created on the fly,
        the first makes use of the object's "ID" field to show additional details
        about that object, while the second makes use of the object's row index value
        to do basically the same thing.
</p>

<p>
        <a href="">Here</a> is the source to the Wrapper class, focus on the getLink1()
        and getLink2() methods.
</p>


<display:table name="sessionScope.details" 
decorator="org.apache.taglibs.display.test.Wrapper" >
  <display:column property="link1" title="ID" />
  <display:column property="email" />
  <display:column property="link2" title="Actions" align="right" />
</display:table>



<%@ include file="inc/footer.jsp" %>
--- NEW FILE: example-decorator.jsp ---
<%@ include file="inc/header.jsp" %>

<% request.setAttribute( "test", new TestList( 10 ) ); %>


<h2><a href="./index.jsp">Examples</a> > Standard, using decorators to transform 
data</h2>

<ul id="showsource">
        <li><a href="./example-decorator.html">View JSP Source</a></li>
</ul>


<display:table name="test" decorator="org.apache.taglibs.display.test.Wrapper" >
  <display:column property="id" title="ID" />
  <display:column property="email" />
  <display:column property="status" />
  <display:column property="date" align="right" />
  <display:column property="money" align="right" />
</display:table>


<p>
        A "<a 
href="http://www-white.media.mit.edu/~tpminka/patterns/Decorator.html";>decorator</a>"
        is a design pattern where one object provides a layer of functionality by
        wrapping or "decorating" another object.
</p>

<p>
        Let's assume you have list of business objects that you want to display, and
        the objects contain properties that don't return native Strings, and you want
        control over how they get displayed in the list (for example, Dates, money,
        numbers, etc...).  I would be bad form to put this type of formatting code
        inside your business objects, so instead create a Decorator that formats the
        data according to your needs.
</p>

<p>
        Click <a href="./Wrapper.java.txt">here</a> to view the source for our Wrapper 
class. 
        Notice the following 4 key things (and refer to the 
        <a href="/[EMAIL 
PROTECTED]@/javadoc/org/apache/taglibs/display/TableDecorator.html">TableDecorator 
documentation</a> 
        for some of the other details).
</p>

<ul>
        <li>
                The Wrapper class must be a subclass of TableDecorator.  There is 
various
                bootstrapping and API methods that are called inside the 
TableDecorator class
                and your class must subclass it for things to work properly (you will 
get a
                JspException if your class does not subclass it).
        </li>
        <li>
                Be smart and create your formatters just once in the constructor 
method -
                performance will be a lot better...
        </li>
        <li>
                Notice how the getDate() and getMoney() methods overload the return 
value
                of your business object contained in the List.  They use the
                <code>TableDecorator.getObject()</code> method to get a handle to the 
underlying
                business object, and then format it accordingly.
        </li>
        <li>
                We do not have to overload each of the other business object properties
                (like getID, getEmail, etc...).  The decorator class is called first, 
but it
                doesn't implement the method for the property called, then the 
underlying
                business class is called.
        </li>
</ul>

<p>
        The way this works is that a single decorator object is created right before
        the table tag starts iteratoring through your List, before it starts processing
        a particular row, it gives the object for that row to the decorator, then as
        the various properties getXXX() methods - the decorator will be called first
        and if the decorator doesn't implement the given property, the method will
        be called on the original object in your List.
</p>

<h3>New - Column Decorators</h3>

<p>
        You can now specify decorators that work on individual columns, this would 
allow
        you to come up with data specific formatters, and just reuse them rather then
        coming up with a custom decorator for each table that you want to show a
        formatted date for.
</p>


<display:table name="test"  >
  <display:column property="id" title="ID" />
  <display:column property="email" />
  <display:column property="status" />
  <display:column property="date" align="right" 
decorator="org.apache.taglibs.display.test.LongDateWrapper" />
</display:table>

<p>
        There are other key API methods in the TableDecorator class that you can
        overwrite, but those details are saved for a later example.
</p>


<%@ include file="inc/footer.jsp" %>
--- NEW FILE: example-details.jsp ---
<%@ include file="inc/header.jsp" %>

<% List list = (List)session.getAttribute( "details" ); %>

<jsp:include page="header.jsp" flush="true" />

<h2><a href="./index.jsp">Examples</a> > Test Object Details</h2>

<ul id="showsource">
        <li><a href="./example-details.html">View JSP Source</a></li>
</ul>


<p>
        This shows the details of the object that you just clicked on, you can image
        that this page could be an edit panel, or another report, or perhaps just
        like what is shown here - additional detailed information about the object that
        you just clicked on.
</p>

<p>
        In these simple contrived example, we are keeping the master list of objects in
        your session and we just do scans based on either the id or index passed in,
        naturally your approach might be different (such as doing a database select
        based on the primary key passed in...)
</p>

<% if( request.getParameter( "action" ) != null ) { %>
<h2>Action: <%= request.getParameter( "action" ) %></h2>
<% } %>

<%
   ListObject obj = null;
   if( request.getParameter( "id" ) != null ) {
      int id = Integer.parseInt( request.getParameter( "id" ) );
      for( int i = 0; i < list.size() ; i++ ) {
         ListObject lobj = (ListObject)list.get(i);

         if( lobj.getId() == id ) { obj = lobj; break; }
      }
   }

   if( request.getParameter( "index" ) != null ) {
      int index = Integer.parseInt( request.getParameter( "index" ) );
      obj = (ListObject)list.get( index );
   }
%>

<blockquote>
<pre>
<%= obj.toDetailedString() %>
</pre>
</blockquote>

<%@ include file="inc/footer.jsp" %>

--- NEW FILE: example-export.jsp ---
<%@ include file="inc/header.jsp" %>

<% request.setAttribute( "test", new TestList( 10 ) ); %>


<h2><a href="./index.jsp">Examples</a> > Wow, data exporting (excel, csv, xml)</h2>

<ul id="showsource">
        <li><a href="./example-export.html">View JSP Source</a></li>
</ul>


<display:table name="test" export="true" 
decorator="org.apache.taglibs.display.test.Wrapper" >
  <display:column property="id" title="ID"/>
  <display:column property="email" />
  <display:column property="status" />
  <display:column property="date" align="right" />
</display:table>


<p>
        When you set the Table Tag's <strong>export</strong> attribute to "true", a 
footer will
        appear below the table which will allow you to export the data being shown in
        various formats, just click on the format (currently supporting CSV, Excel, and
        a very crude XML).
</p>


<%@ include file="inc/footer.jsp" %>
--- NEW FILE: example-grouping.jsp ---
<%@ include file="inc/header.jsp" %>

<% request.setAttribute( "test", new ReportList() ); %>

<h2><a href="./index.jsp">Examples</a> > Wow, column grouping</h2>

<ul id="showsource">
        <li><a href="./example-grouping.html">View JSP Source</a></li>
</ul>


<display:table name="test" class="simple">
  <display:column property="city" title="CITY" align="left" group="1"/>
  <display:column property="project" title="PROJECT" align="left" group="2"/>
  <display:column property="amount" title="HOURS" align="left" />
  <display:column property="task" title="TASK" align="left"/>
</display:table>


<p>
        You have a List who's objects are sorted and grouped by column A, column B and
        column C, so instead of repeating columns A, B over and over again, it does a
        grouping of those columns, and only shows data in those columns when it 
changes.
        Think of reports...  We use the this display tag as a key part of our
        reporting framework.
</p>

<p>
        Grouping is straight-forward, simply make sure that your list that you are
        providing is sorted appropriately, then then indicate the grouping
        order via the <strong>group</strong> attribute of the column tags.
</p>

<p>
        The <a href="example-callbacks.jsp">callbacks</a> example shows how to extend 
this and use callbacks
        to extend the table tag in order to show totals for particular groups.  Finally
        pair this with the
        <a href="example-export.jsp">data exporting</a> and the soon to be implemented
        ResultSet functionality and you have a key piece of an easy to understand 
reporting framework.
</p>


<%@ include file="inc/footer.jsp" %>
--- NEW FILE: example-imp-objects.jsp ---
<%@ include file="inc/header.jsp" %>

<% request.setAttribute( "test", new TestList( 10 ) ); %>


<h2><a href="./index.jsp">Examples</a> > Basic, implicit objects created by table</h2>

<ul id="showsource">
        <li><a href="./example-imp-objects.html">View JSP Source</a></li>
</ul>



<display:table name="test" id="testit">
    <display:column property="id" title="ID" />
    <display:column property="name" />
    <display:column property="email" />
    <display:column property="status" styleClass="tableCellError"/>
    <display:column property="description" title="Comments"/>
    <display:column title="extra">static</display:column>
    <display:column title="row number"><%=testit_rowNum%></display:column>
    <display:column 
title="((ListObject)testit).getMoney()"><%=((ListObject)testit).getMoney()%></display:column>
</display:table>

<p>
        I include this page, as it is a reasonable assumption/resquest that this tag
        would work like other iterating tags, and perhaps make the object corresponding
        to the given row available as some type of implicit object that you could use
        inside scriptlet code (or some other tag) for you to access while the list you
        provided is being looped over.
</p>

<p>
        I tried designing this as an iterating tag that would expose the underlying
        object each time through the loop, etc...  But I ran into many problems, and
        ultimatly decided that using "<a href="example-decorator.jsp">decorators</a>"
        provided the same type of functionality and was cleaner as it helped keep code
        out of the JSP pages.
</p>

<p>
        So if you have come to this page, thinking I wish I had access to the objects
        as they were being processed in the loop in my JSP page, well I'm not going to
        provide that - but look at the following three pages and I'll bet one of them
        will have a solution to your problem.
</p>

<ul>
        <li><a href="example-decorator.jsp">Standard, using decorators to 
transform/process data</a>
        <li><a href="example-decorator-link.jsp">Standard, using decorators to create 
dynamic links</a>
        <li><a href="example-callbacks.jsp">Wow, using callbacks to show totals</a>
</ul>

<p>
Rather then implementing this tag as an iterating tag, it's implemented as
follows: The various column tags register themselves with the parent table tag
just once, and when we hit the closing table tag, we use the configuration data
provided in the table attributes, and the column tags to blast through the list
of objects and draw the table all at once.  We do <strong>not</strong> loop over the
column tags and call them over and over, and thus we can't really provide any
implicit objects that would be useful to you in the JSP page...  Doing that
caused the following problems:
</p>

<ul>
        <li>broke sorting, as we need to do some processing of the entire list up 
front.</li>
        <li>made dealing with exceptional cases difficult (no values, null values)</li>
        <li>made performance horrible (3-5 times slower, then just creating the buffer 
in the end tag).</li>
        <li>probably others, I moved away from this approach pretty early on.</li>
</ul>


<%@ include file="inc/footer.jsp" %>
--- NEW FILE: example-misc.jsp ---
<%@ include file="inc/header.jsp" %>

<% request.setAttribute( "test", new TestList( 10 ) ); %>
<% request.setAttribute( "test2", new ArrayList() ); %>
<% Object foo = session.getAttribute( "test3" );
   if( foo == null ) {
      session.setAttribute( "test3", new TestList( 320 ) );
   }
%>

<h2><a href="./index.jsp">Examples</a> > Miscellaneous...</h2>

<ul id="showsource">
        <li><a href="./example-config.html">View JSP Source</a></li>
</ul>


<p>
        This page shows how to use various bells and whistles that are features of the
        display taglib that you might not be aware of.
</p>

<p>
        This table shows how you can use the "nulls" attribute to suppress "null" 
values
        that might be returned from your business objects.  It also shows the 
"maxLength"
        attribute being used to restrict the size of the LongDescription column, so 
that
        it fits within a certain size of table.
</p>

<display:table name="test" >
  <display:column property="id" title="ID" />
  <display:column property="nullValue" nulls="false"/>
  <display:column property="longDescription" maxLength="60" nowrap="true"/>
</display:table>


<%@ include file="inc/footer.jsp" %>
--- NEW FILE: example-nocolumns.jsp ---
<%@ include file="inc/header.jsp" %>
<% 
        request.setAttribute( "test", new TestList( 6 ) );
        List test2 = new ArrayList( 6 );
        test2.add( "Test String 1" );
        test2.add( "Test String 2" );
        test2.add( "Test String 3" );
        test2.add( "Test String 4" );
        test2.add( "Test String 5" );
        test2.add( "Test String 6" );
        request.setAttribute( "test2", test2 ); 
%>

<h2><a href="./index.jsp">Examples</a> > Simple case, no columns</h2>

<ul>
        <li><a href="./example-nocolumns.html">View JSP Source</a></li>
</ul>

<display:table name="test2" />

<display:table name="test" />

<p>
        The simplest possible usage of the table tag is to simply point the table
        tag at a list object and do nothing else.  The table tag will loop through the
        list and call <code>toString()</code> on each object and displays that value in
        the table's single column.  The title of the table will be a message indicating
        that you should provide some default column tags.
</p>

<p>
        The table on the left points to a List of simple strings, while the table on 
the right
        points at a list of ListObject objects. I have implemented my own
        <code>toString()</code> method in ListObject, otherwise the data in the column
        below would look like the standard Object toString() method
        (<code>[EMAIL PROTECTED]</code>).
</p>

<p>
        Typically the only time that you would want to use the tag in this simple way,
        is during development just as a sanity check, or while debugging.  For
        production, you should always define at least a single column if for no other
        reason that you can set the column title.
</p>

<%@ include file="inc/footer.jsp" %>
--- NEW FILE: example-paging.jsp ---
<%@ include file="inc/header.jsp" %>

<% Object foo = session.getAttribute( "test" );
   if( foo == null ) {
      session.setAttribute( "test", new TestList( 320 ) );
   }
%>

<h2><a href="./index.jsp">Examples</a> > Wow, auto-paging of long lists</h2>

<ul id="showsource">
        <li><a href="./example-paging.html">View JSP Source</a></li>
</ul>


<display:table name="sessionScope.test" pagesize="15" 
requestURI="http://edhill.its.uiowa.edu/[EMAIL PROTECTED]@/example-paging.jsp">
  <display:column title="Index" value="5" />
  <display:column property="id" title="ID" />
  <display:column property="name" />
  <display:column property="email" />
  <display:column property="status" />
  <display:setProperty name="sort.behavior" value="list" />
  <display:setProperty name="paging.banner.include_first_last" value="true" />
</display:table>


<p>
        Ok, you have made a query that returns you back a list of 120 elements, but you
        don't want to show the user all 120 items at once, you want to allow them to
        page through the results (pretend 120 is really 1200 or 12000).
</p>

<p>
        One of the most common web UI techniques is to show a page of data (items 
1-10),
        and then let the user click on a page number and allow them to scroll through
        the list.  Include the "pagesize" attribute to your table tag, and the tag 
takes
        care of the reset.
</p>

<p>
        You need to design your page, so that the JSP page with the table tag can be 
reloaded
        without reloading the entire list of entries.  It is assumed that you have gone
        through the action of loading the list in a previous page (or action in
        Struts-speak), and then redirected the person to the page with the table tag 
on it.
</p>

<p>
        You need to do this because the table tag's various page links will all point 
to
        the page the table tag is on (but also providing various parameters - which the
        table tag itself parses and deals with).  So if you are doing any processing on
        the page, it can either 1) simply not work because the table tag doesn't know
        what parameters to pass for your processing, or 2) slow things down because you
        would be reloading the entire list on each page, rather then just showing a 
subset
        of the list.  It sounds confusion, but that's just because I do a poor job of
        explaining it...
</p>

<p>
        By default, the table tag tries to figure out what the URL is for the page it
        is on by calling the request.getRequestURI() method, but this will not always 
return
        a correct answer in environment where you are forwarding a request around 
before
        arriving at the JSP that is to be displayed (like struts).  In those cases, you
        need to tell the table tag what it's URL is via the "requestURI" attribute.<p>
</p>

<%@ include file="inc/footer.jsp" %>
--- NEW FILE: example-pse.jsp ---
<%@ include file="inc/header.jsp" %>

<% request.setAttribute( "test", new ReportList() ); %>

<h2><a href="./index.jsp">Examples</a> > Wow, paging + sorting + exporting</h2>

<ul id="showsource">
        <li><a href="./example-pse.html">View JSP Source</a></li>
</ul>



<display:table name="test" export="true" sort="list" pagesize="10">
  <display:column property="city" title="CITY" align="left" group="1" sortable="true" 
headerClass="sortable"/>
  <display:column property="project" title="PROJECT" align="left" group="2" 
sortable="true" headerClass="sortable"/>
  <display:column property="amount" title="HOURS" align="left" />
  <display:column property="task" title="TASK" align="left"/>
</display:table>

<p>
        ...
</p>


<%@ include file="inc/footer.jsp" %>
--- NEW FILE: example-sorting.jsp ---
<%@ include file="inc/header.jsp" %>


<% Object foo = session.getAttribute( "stest" );
   if( foo == null ) {
      session.setAttribute( "stest", new TestList( 10 ) );
   }
%>


<h2><a href="./index.jsp">Examples</a> > Wow, auto-sorting by columns</h2>

<ul id="showsource">
        <li><a href="./example-sorting.html">View JSP Source</a></li>
</ul>


<display:table name="sessionScope.stest">
  <display:column property="id" title="ID" sort="true" headerClass="sortable" />
  <display:column property="name" sort="true" headerClass="sortable"/>
  <display:column property="email" />
  <display:column property="status" sort="true" headerClass="sortable"/>
</display:table>

<p>
        If you want to allow the user to sort the data as it is coming back, then you
        need to just do two things, make sure that the data
        returned from your property implements the Comparable interface (if it doesn't
        nativly - use the decorator pattern as shown a couple of examples ago), and
        then set the attribute <code>sort="true"</code> on the columns that you want
        to be able to sort by.
</p>

<p>
        When the user clicks on the column title the rows
        will be sorted in ascending order and redisplayed on the page.  If the user 
clicks
        on the column title again, the data will get sorted in descending order and
        redisplayed.
</p>

<p>
        Only the rows being shown on the page are sorted and resorted, so if you use
        this attribute along with the pagesize attribute, it will not resort the
        entire list.  It is assumed that if you want to allow the user to resort a 
large
        list that will not all fit on a single page, then you will provide an interface
        which is more appropriate to that task.
</p>

<p>
        When doing sorts, we copy the list into our own internally managed list, so
        that we don't change the ordering of the original list.
</p>

<%@ include file="inc/footer.jsp" %>

--- NEW FILE: example-styles.jsp ---
<%@ include file="inc/header.jsp" %>

<% request.setAttribute( "test", new TestList( 10 ) ); %>

<% String lClass = "isis";
   if( request.getParameter( "class" ) != null ) {
      lClass = request.getParameter( "class" );
   }
%>


<h2><a href="./index.jsp">Examples</a> > Basic, columns - different styles</h2>

<ul id="showsource">
        <li><a href="./example-styles.html">View JSP Source</a></li>
</ul>


<ul>
        <li><a href="example-styles.jsp?class=isis">ISIS</a></li>
        <li><a href="example-styles.jsp?class=its">ITS</a></li>
        <li><a href="example-styles.jsp?class=mars">Mars</a></li>
        <li><a href="example-styles.jsp?class=simple">Simple</a></li>
        <li><a href="example-styles.jsp?class=report">Report</a></li>
        <li><a href="example-styles.jsp?class=mark">Mark Column</a></li>
</ul>


<display:table name="test" class="<%=lClass%>">
  <display:column property="id" title="ID" />
  <display:column property="name" />
  <display:column property="email" />
  <display:column property="status" class="tableCellError" />
  <display:column property="description" title="Comments"/>
</display:table>

<p>
        You actually have a lot of flexibility in how the table is displayed, but of
        course you should probably stay close to the defaults in most cases.  You 
adjust
        the look of the table via two methods, 1) pass through table and
        column attributes, and 2) Style sheets which are described below.
</p>

<p>
        Click through the above links to see different style examples of the same
        basic table.  Most of the differences in appearance between the tables below
        are achieved via only stylesheet changes.
</p>


<h3>Html attributes</h3>

<p>
        You can assign to the &lt;display:table&gt; tag any standard html attribute 
(es. cellspacing,
        cellpadding), and it will be included in the rendered table.
</p>

<p class="changed">
        Starting from version 0.9 the &lt;display:table&gt; there are no default for 
html attributes
        not explicitely setted. Why? Because so you can totally control the display of 
your table
        and you can do that (as we hope) totally using css, avoiding deprecated html 
presentational
        attribute (did you notice this website is written using xhtml strict?).
</p>



<p>
        Likewise, you can assign to the &lt;display:column&gt; tag any standard html 
attribute 
        ant it will be included in any &lt;td&gt; tag of the rendered table.
        You can also specify a class to be used only for the column header 
(&lt;th&gt;) adding a 
        <code>headerClass</code> attribute.
<p>

<p class="changed">
        Note: the attribute <code>styleClass</code> used for the &lt;table&gt; and  
&lt;column&gt; tag 
        in previous version of the taglibrary is deprecated in favour of the standard 
html <code>class</code> atribute
</p>




<h3>Style Sheets</h3>

<p>
        While attributes might be the most comfortable way to change the appearance
        of your table, using style sheets are more powerful.  We use style sheets to
        make the header a dark color, make the rows alternate color, and set the fonts
        within the cells to a smaller version of verdana.  As the &lt;display:table&gt;
        tag is drawing it assigns the following class names to elements.
</p>

<p>
        You can then create a style sheet and assign attributes such as font size,
        family, color, etc... to each of those class names and the table will be
        shown according to your styles.
</p>

<p class="changed">
        Starting from version 0.9 the &lt;display:table&gt; tag produce good html 
tables with 
        &lt;thead&gt; and &lt;tbody&gt; sections. This makes useless the definition of 
few styles
        used in previous versions. See the @deprecated paragraph at the bottom of the 
page for details
</p>

<p class="changed">
        New styles are added for sorted columns and display of pagination
        is handled by properties.
</p>

<table>
        <thead>
                <tr>
                        <th>class</th>
                        <th>assigned to</th>
                </tr>
        </thead>
        <tbody>
                <tr>
                        <td>odd</td>
                        <td>assigned to the tr tag of all odd numbered data rows</td>
                </tr>
                <tr>
                        <td>even</td>
                        <td>assigned to the tr tag of all even numbered data rows</td>
                </tr>
                <tr>
                        <td>sorted</td>
                        <td>assigned to the th tag of the sorted column</td>
                </tr>
                <tr>
                        <td>order1</td>
                        <td>assigned to the th tag of the sorted column if sort order 
is ascending</td>
                </tr>
                <tr>
                        <td>order2</td>
                        <td>assigned to the th tag of the sorted column if sort order 
is descending</td>
                </tr>
        </tbody>
</table>

<h3>Old Styles @deprecated</h3>

<p class="changed">
        These css classes were applied in previous version of the &lt;display:*&lt; 
tag library. See the "now use"
        column for direction on how migrate your css to the new version (a quick task 
wich will also improve the
        quality -and lower the weight- of your html output)
</p>

<table>
        <thead>
                <tr>
                        <th>class</th>
                        <th>was</th>
                        <th>now use</th>
                </tr>
        </thead>
        <tbody>
                <tr>
                        <td>table</td>
                        <td>assigned to the main table tag</td>
                        <td>on class is assigned by default. You can add your own 
adding a "class" attrbute to the &lt;display:table&gt; tag</td>
                </tr>
                <tr>
                        <td>tableRowAction</td>
                        <td>assigned to the tr tag of the action row (paging, export, 
etc...)</td>
                        <td>You can totally customize the html generated using 
properties, no css class is added by default</td>
                </tr>
                <tr>
                        <td>tableRowHeader</td>
                        <td>assigned to the tr tag of the header row</td>
                        <td>
                                Assign a style to <code>thead tr</code> element, you 
don't need a class. 
                                If you want this style to be applied only to the 
&lt;display:table&gt; simply add a class or id
                                to the table tag and create a children rule in css 
like <code>table.myclass thead tr {color:red;}</code>
                        </td>
                </tr>
                <tr>
                        <td>tableRowOdd</td>
                        <td>assigned to the tr tag of all odd numbered data rows</td>
                        <td>the name of the class is now simply "odd"</td>
                </tr>
                <tr>
                        <td>tableRowEven</td>
                        <td>assigned to the tr tag of all even numbered data rows</td>
                        <td>the name of the class is now simply "even"</td>
                </tr>
                <tr>
                        <td>tableCellAction</td>
                        <td>assigned to the td tag of all actions cells (paging, 
export, etc...)</td>
                        <td>You can totally customize the html generated using 
properties, no css class is added by default</td>
                </tr>
                <tr>
                        <td>tableCellHeader</td>
                        <td>assigned to the td tag of all header cells</td>
                        <td>
                                Assign a style to <code>thead th</code> element, you 
don't need a class. 
                                If you want this style to be applied only to the 
&lt;display:table&gt; simply add a class or id
                                to the table tag and create a children rule in css 
like <code>table.myclass thead th {color:red;}</code>
                        </td>
                </tr>
                <tr>
                        <td>tableCell</td>
                        <td>assigned to the td tag of all data cells</td>
                        <td>
                                Assign a style to <code>tbody td</code> element, you 
don't need a class.
                                If you want this style to be applied only to the 
&lt;display:table&gt; simply add a class or id
                                to the table tag and create a children rule in css 
like <code>table.myclass tbody td {color:red;}</code>
                        </td>
                </tr>
        </tbody>
</table>


<%@ include file="inc/footer.jsp" %>
--- NEW FILE: example-subsets.jsp ---
<%@ include file="inc/header.jsp" %>


<% request.setAttribute( "test", new TestList( 25 ) ); %>

<h2><a href="./index.jsp">Examples</a> > Basic, showing subsets of data from the 
List</h2>

<ul id="showsource">
        <li><a href="./example-subsets.html">View JSP Source</a></li>
</ul>


<h4>Complete List</h4>

<display:table name="test" >
  <display:column property="id" title="ID" />
  <display:column property="email" />
  <display:column property="status" />
</display:table>


<h4>First 5 Items</h4>

<display:table name="test" length="5">
  <display:column property="id" title="ID" />
  <display:column property="email" />
  <display:column property="status" />
</display:table>


<h4>Items 11-20</h4>

<display:table name="test" offset="10" length="10">
  <display:column property="id" title="ID" />
  <display:column property="email" />
  <display:column property="status" />
</display:table>



<p>
        Let's say that you have a list that contains 300 elements, but you only want
        to show the first 10, or for some reason you want to show elements 101-120 
(Yes,
        I know what you really want is to be able to page through them - be patient
        that example is coming up).
</p>

<p>
        You can use the <code>length</code> and <code>offset</code> attributes to limit
        the display to only portions of your List.
</p>

<%@ include file="inc/footer.jsp" %>
--- NEW FILE: index.jsp ---
<%@ include file="inc/header.jsp" %>
<h2>Examples</h2>

<p>
        The following examples all show the functionality of the table/column tags.  
These
        example pages also allow you to view the JSP source, so you can see how you
        might interface with the tag in your own application.
</p>

<ul>
        <li><a href="example-nocolumns.jsp">Simplest case, no columns</a></li>
        <li><a href="example-columns.jsp">Basic, columns</a></li>
        <li><a href="example-styles.jsp">Basic, columns - different styles</a></li>
        <li><a href="example-datasource.jsp">Basic, acquiring your List of 
data</a></li>
        <li><a href="example-imp-objects.jsp"><strong>New</strong>, implicit objects 
created by table</a></li>
        <li><a href="example-subsets.jsp">Basic, showing subsets of data from the 
List</a></li>
        <li><a href="example-autolink.jsp">Standard, smart linking of column 
data</a></li>
        <li><a href="example-decorator.jsp">Standard, using decorators to 
transform/process data</a></li>
        <li><a href="example-decorator-link.jsp">Standard, creating dynamic 
links</a></li>
        <li><a href="example-paging.jsp">Wow, auto-paging of long lists</a></li>
        <li><a href="example-sorting.jsp">Wow, auto-sorting by columns</a></li>
        <li><a href="example-paging-sorting.jsp"><strong>New</strong>, auto-paging 
plus auto-sorting of full list</a></li>
        <li><a href="example-grouping.jsp">Wow, column grouping</a></li>
        <li><a href="example-callbacks.jsp">Wow, using callbacks to show 
totals</a></li>
        <li><a href="example-export.jsp">Wow, data exporting (excel, csv, xml)</a></li>
        <li><a href="example-config.jsp">Config, overriding default 
behaviors/messages</a></li>
        <li><a href="example-misc.jsp">Misc, odds and ends</a></li>     
        <!--
        <li><a href="example-filtering.jsp">Wow, filtering by columns</a> (coming...)
        <li><a href="example-resultset.jsp">By Demand, working with jdbc results</a> 
(coming...)
        <li><a href="example-column-chooser.jsp">Wow, user choice over which columns 
get displayed</a> (coming...)
        -->
</ul>


<%@ include file="inc/footer.jsp" %>



-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
displaytag-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel

Reply via email to