title: Dynamically generate a table within a row of a table
body: <p>I have a SEAM 2, JSF 1.2 web application with a Java back end.   Currently I have table that displays books (see below).  What I need to add to this is a collapse-able table to each of these rows that would show previous versions of this book (#{_item.relatedVersions}).  Each of these version are a book themselves (but don't have an expandable sub-version table, i.e only 1 level deep on a nested table).  So what I am wondering is what is the cleanest way to display a list of books (#{bean.items}) in "Table A", and then foreach book dynamically generate another Table within a row in "Table A"?</p>
  
  <p>...</p>
  
  <pre><code>&lt;a:form id="bookList_results_form"&gt;
         &lt;rich:dataTable id="bookList_dt"
                      rendered="#{bean.itemCount gt 0}"
                      var="_item"
                      width="100%"
                      value="#{bean.items}"&gt;
  
             &lt;rich:column&gt;
                 &lt;f:facet name="header"&gt;ID&lt;/f:facet&gt;
                 &lt;h:outputText value="#{_item.bookId}"/&gt;
             &lt;/rich:column&gt;
  
             &lt;rich:column&gt;
  
              &lt;a:commandButton image="#{plusIcon}" size="15" 
              title="Expand version info."
              action="#{bean. ???}"
              ajaxSingle="true" bypassUpdates="true" immediate="true"/&gt;
  
              &lt;f:facet name="header"&gt;Book Name&lt;/f:facet&gt;
                 &lt;h:outputText value="#{_item.bookName}" escape="true"/&gt;
             &lt;/rich:column&gt;
  
             &lt;rich:column&gt;
              &lt;f:facet name="header"&gt;Comments&lt;/f:facet&gt;
                 &lt;h:outputText value="#{_item.comments}"/&gt;
             &lt;/rich:column&gt;
  
             &lt;rich:column&gt;
  
              &lt;f:facet name="header"&gt;Actions&lt;/f:facet&gt;
              &lt;a:commandLink
                  value="Edit"
                  title="View or Edit metadata for this book"
                  action="#{bean.edit(_item.bookId)}"/&gt;
  
             &lt;/rich:column&gt;
         &lt;/rich:dataTable&gt;
  &lt;/a:form&gt;
  </code></pre>
  
  <p>...</p>