title: displaytag dynamic columns from database
body: <p>i want using display tag in struts2 web application for display data from database. The data display dynamically change table name and show the data. how to display dynamic column in jsp.
  i used following code. it's working one row only. how to add multiple row  in display table?</p>
  
  <pre><code>  public class TableDataDyno {
  
  private ArrayList&lt;Object&gt; dynaBeans;
  public TableDataDyno()
  {
      dynaBeans = new ArrayList&lt;Object&gt;();
  
      dynaBeans.add(new DynaBean("One","5"));
      dynaBeans.add(new DynaBean("One","6"));
      dynaBeans.add(new DynaBean("One","7"));
      dynaBeans.add(new DynaBean("One","8"));
      dynaBeans.add(new DynaBean("One","9"));
  
      dynaBeans.add (new DynaBean("Two", "5"));
      dynaBeans.add (new DynaBean("Two", "6"));
      dynaBeans.add (new DynaBean("Two", "7"));
      dynaBeans.add (new DynaBean("Two", "8"));
      dynaBeans.add (new DynaBean("Two", "9"));
  
  
      dynaBeans.add(new DynaBean("Three", "5"));
      dynaBeans.add(new DynaBean("Three", "6"));
      dynaBeans.add(new DynaBean("Three", "7"));
      dynaBeans.add(new DynaBean("Three", "8"));
      dynaBeans.add(new DynaBean("Three", "9"));
  
  }
  public ArrayList&lt;Object&gt; getdynaBeans() {
      return dynaBeans;
  }
  
      public class DynaBean {
  private String title;
    private String value;
        public DynaBean(String title, String value) {
          this.title = title;
          this.value = value;
      }
          public String getTitle() {
          return title;
      }
      public String getValue() {
          return value;
      }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>         java.util.ArrayList outerBeans = new java.util.ArrayList();
                 for(int i=0; i&lt; 2 ; i++)
                 {
                   outerBeans.add(new TableDataDyno());
                 }
                  System.out.println(outerBeans);
     request.setAttribute("items", outerBeans);
  
  
  
          &lt;display:table uid="item" name="items"&gt;
     &lt;c:forEach var="cl" items="${item.dynaBeans }" varStatus="index"&gt;
         &lt;display:column title="${cl.title}" property="dynaBeans[${index.index}].value"  /&gt;
     &lt;/c:forEach&gt;
  </code></pre>
  
  <p></p>
  
  <p>output is:<img src="https://i.stack.imgur.com/peLBb.png" alt="enter image description here"></p>
  
  <p>Expected Output:
  <img src="https://i.stack.imgur.com/qJjce.png" alt="enter image description here"></p>