title: How do I print a list of strings contained within another list in iReport?
body: <p>I am creating a simple reporting program using java and iReport (from jasper), which is supposed to create a report in pdf showing PCs with their IP address, their location, whether it's idle or not at the moment (handled by another system), and a list of projects it is currently attached to (managed elsewhere, too).</p>
  
  <p>I'm using iReport for this matter, and have created a dummy collection generating class as follows:</p>
  
  <pre><code>public class PCReports {
  
      public static java.util.Collection PC_collection;
      public static java.util.Collection generateCollection() {
  
          PC_collection = new ArrayList&lt;PCLineDTO&gt;();
          PCLineDTO line = new PCLineDTO();
          line.setIP("192.168.1.1");
          line.setLab("location");
          line.setActive(true);
          line.addProjectName("project1");
          line.addProjectName("project2");
          line.addProjectName("project3");
          PC_collection.add(line);
  
          line = new PCLineDTO();
          line.setIp("192.168.1.2");
          line.setLab("location2");
          line.setActive(false);
          line.addProjectName("project1");
          line.addProjectName("project2");
          PC_collection.add(line);
  
          return PC_collection;
      }
  }
  </code></pre>
  
  <p>The entity class in this case being:</p>
  
  <pre><code>public class PCLineDTO {
      private String ip;
      private String lab;
      private Boolean active;
      private ArrayList&lt;String&gt; projects;
  }
  </code></pre>
  
  <p>After some searching around the Internet, I found <a href="http://knol.google.com/k/jasper-reports-working-with-beans-and-sub-report" rel="noreferrer">a way to do something similar</a>, using subreports. </p>
  
  <p>The thing is, I don't know how to print a collection of strings passed as a dataSource to this subreport.</p>
  
  <p>In the examples I found on the Internet, for each item in the master collection, the subreports were passed a collection of <em>objects</em> -with their own getter methods for each attribute- instead of a collection of <em>strings</em> as is the case here. In those cases, they accessed the values they needed to use via the iReport syntax, which I was not able to use, for example:</p>
  
  <pre><code>$F{project}
  </code></pre>
  
  <p>Since iReport looks for a getProject method contained within the objects it receives, but in this case it's a simple String object (without a getProject method, as it were).</p>