title: How to print a Arraylist of Strings in Jasper 4.5.1 using Struts plugin
body: <p>Has anyone managed to print an ArrayList within a Javabean in Struts using Jasper reports 4.5.0  </p>
  
  <p>In my test case I am using a Collection as a field and passing it as a subdataset, using the _THIS I have managed to print the array of strings in my Javabean...</p>
  
  <p>According to <a href="http://jasperreports.sourceforge.net/sample.reference/datasource/index.html" rel="nofollow">Jasper</a>: A special field mapping can be used to access the current JavaBean object itself. Thus, when a field uses _THIS as description or name, the data source will return the current JavaBean object as field value. </p>
  
  <pre><code>&lt;field name="facilities" class="java.util.Collection"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[facilities]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  </code></pre>
  
  <p>where the subdatase is:</p>
  
  <pre><code>&lt;subDataset name="facilities Dataset"&gt;
      &lt;field name="facility" class="java.lang.String"&gt;
          &lt;fieldDescription&gt;&lt;![CDATA[_THIS]]&gt;&lt;/fieldDescription&gt;
      &lt;/field&gt;
  &lt;/subDataset&gt;
  </code></pre>
  
  <p>in order to print the list of string using the listComponent i use</p>
  
  <pre><code>&lt;c:list xmlns:c="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Horizontal"&gt;
                      &lt;datasetRun subDataset="facilities Dataset"&gt;
                          &lt;dataSourceExpression&gt;&lt;![CDATA[$F{facilities}]]&gt;&lt;/dataSourceExpression&gt;
                      &lt;/datasetRun&gt;
                      &lt;c:listContents height="10" width="180"&gt;
                          &lt;frame&gt;
                              &lt;reportElement positionType="Float" x="0" y="0" width="180" height="10"/&gt;
                              &lt;textField isStretchWithOverflow="true"&gt;
                                  &lt;reportElement style="ListComp" x="0" y="0" width="180" height="10"/&gt;
                                  &lt;textElement textAlignment="Left" markup="html"/&gt;
                                  &lt;textFieldExpression  class="java.lang.String"&gt;&lt;![CDATA["&lt;li&gt;" +$F{facility} +"&lt;/li&gt;"]]&gt;&lt;/textFieldExpression&gt;
                              &lt;/textField&gt;
                          &lt;/frame&gt;
                      &lt;/c:listContents&gt;
  </code></pre>
  
  <p></p>
  
  <p>For struts I replaced the Collection class in my field with </p>
  
  <pre><code>org.apache.struts2.views.jasperreports.ValueStackDataSource
  </code></pre>
  
  <p>Although it does print the correct number of strings in the array the value printed is null.</p>