The usage of Grid taglib

This file contains a sample for Grid taglib. Here we will create a Grid with paging. For paging support we will use Pager taglib from Coldtags suite. How it looks like? In our case we will have a simple array that will be formatted as a grid. And we will output just 2 rows per page:


<!-- grid taglib -->
<%@ taglib uri="taglib122.tld" prefix="g" %>

<!-- pager taglib -->
<%@ taglib uri="taglib139.tld" prefix="pg" %>

<!-- our data -->
  String a[]={ "A", "B", "C","D" };

<!-- describe paging. Size is 2 records -->
<pg:paging pageSize="2">

<!-- describe our grid -->
<g:grid source="<%=a%>" autoGenerateColumns="false" borderWidth="1">

<!-- headers -->
   <g:column>Check Box</g:column>

<!-- rows -->

   <!-- row contains an item for our paging -->
     <g:column><input type="checkbox" name=c<%=rowNumber%>></g:column>



<!-- index -->
<pg:index title="Pages:">



and you will get some like this:

Data Check Box
Pages: 1 2

 © Coldbeans   Comments?

See also Other tips from Coldbeans.