provided by: 
Originally published at Internet.comGenerating dynamic content in Web applications is important when the content must reflect the most current and available data and personalized information. One of the main advantages of JavaServer Pages is the ability to generate dynamic content.
Many Web sites depend on the ability to generate tables dynamically, which consists of controlling the TR and TD tags within a TABLE. The online stock portfolio mentioned earlier is a good example where dynamic tables are useful.
The following example shows how to generate five rows without having to code each one of them:
<% for(int row=1; row <= 5; row++) { %>
|
<% } %>
Ten columns can be added for each row by nesting another for loop within the TR tag as follows:
<% for(int row=1; row <= 5; row++) { %>
<% for(int col=1; col<=10; col++) { %>
(<%=col%>, <%=row%>) |
<% } %>
<% } %>
Each cell contains its row and column numbers as the tuple (col, row).
The following listing shows how tables can be generated dynamically. The JSP provides two INPUT fields to define the width and height of the dynamic table. When the user submits the form, the JSP processes the request and generates the table on-the-fly. Each cell of the table has a unique background color and text based on the row and column of the cell...
Read article at Internet.com site