Hi, everyone.
Here are some tips and examples for those of you who have tried, or are
planning to try, my ViewTableTag (Now zipped up at
http://www.geocities.com/jonathan_bingham/jsp/tabletag.zip ). I've updated
the javadocs and the example page.
Cheers,
Jonathan
BUG WARNING:
In some versions of Tomcat, you cannot use
<tbl:viewTable table="attrName" />
Instead you must use
<tbl:viewTable table="<%= attrName %>" />
The bug was introduced in the Tomcat 3.2.1 release. I filed I bug report
with a code fix, and I believe the latest milestone includes the fix.
SWING TABLE MODEL:
For anyone not familiar with the javax.swing.table.TableModel, the easiest
route is to extend javax.swing.table.AbstractTableModel. It takes only a few
minutes to cook up a dummy table.
Or you can use a java.sql.ResultSet for your table instead. E.g.,
<tbl:viewTable table="<%= resultSet %>" />
MORE EXAMPLES:
<!-- Paginate table and color the column headers -->
<tbl:viewTable
table="<%= aTableModel %>"
rowsPerPage="20"
pageNumber="2"
columnHeaderAttributes="style=\"background: #CCCCCC\"" />
<!-- Add hyperlinks to the first column -->
<tbl:viewTable
table="<%= aTableModel %>"
columnLink="0,productDetail.jsp?productId=$value" />
<!-- Make table rows selectable with radio buttons -->
<tbl:viewTable
table="<%= myResultSet %>"
rowSelection="rowNumber=$row"
rowSelectionMode="single" />