title: Print an arraylist content with JasperReports
body: <p>I want to print the content of an ArrayList using <em>JasperReports</em> in Java </p>
  
  <p>Actually I am know little about Jasper Reporting
  I use iReport to create Japser Reports and using Java command I will print it.</p>
  
  <p>Now I want to print the student results using <em>JasperReports</em>.
  This is my sample results table. </p>
  
  <pre><code>Reg.No  SubjectCode  Level  Semester  Grade  Marks
  132108  CMIS 1113    1        1        A      77
  132107  CMIS 1213    1        2        C      57
  122101  IMGT 2112    2        1        A      87
  122110  IMGT 2213    2        2        A      83
  112123  STAT 3113    3        1        C      55
  112135  MATH 3213    3        2        B      67
  132145  CMIS 1113    1        1        D      17
  122118  ELTN 2213    1        2        A      90
  112100  CMIS 3213    3        2        A      89
  112117  SATA 3113    1        1        A      87
  122104  CMIS 2213    2        2        C      54
  132104  CMIS 1213    1        2        A      84
  </code></pre>
  
  <p>So according to my above table I need to print "Results of student in particular level in particular semester".
  <br>In my interface I have facility to select the Level and the Semester.<br>
  Then the relevant query with generate automatically and results will obtain from the database and using Results object(I create class called 'Results' to store the results of a particular student) I add the results data to a ArrayList.<br>
  Now my ArrayList have the Results objects which carries the results of each students in particular level and particular semester.Now I want to print this ArrayList using Jasper report.So expected Jasper Report is like this.<br>For Level 1 and Semester 1,<br> </p>
  
  <pre><code>Reg.No  CMIS1113   
  132108    A
  132145    D
  </code></pre>
  
  <p><br>For Level 2 and Semester 2,<br></p>
  
  <pre><code>Reg.No  IMGT2213  CMIS2213   
  122110    A          -
  122104    -          C
  </code></pre>
  
  <p><br>Now I have several problems.<br><br>
  1) Normally what I did previously is when I create Jasper Template using iReport I gave the relevant query before creating it.But here query will be changed according to selected Level and Semester.So the result will be changed according to the query.And column headers also changed because subjects are changing.(Number of subject are not similar in each semester and each level)So my question is how can I create a common Jasper Templates to Handle each situation?(if possible)<br></p>
  
  <p>2) How I print the ArrayList using Java code.I do not know the java code to print the content of ArrayList using Jasper Report.<br></p>
  
  <p>I know very few things about Jasper Reports.So if you can please help me.Thank You.</p>